about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-07-27 10:50:33 -0700
committerKartik Agaram <vc@akkartik.com>2018-07-27 10:50:33 -0700
commitab2ee1d4afe9cf595fd64ba306c43c3aa4ceb8ce (patch)
treee43cd8fd236da79252292bbe21a250b6e7cec67d
parent29426e5d765f10e10aeb3d5380a3fa91bd2bfed9 (diff)
downloadmu-ab2ee1d4afe9cf595fd64ba306c43c3aa4ceb8ce.tar.gz
4436
-rw-r--r--subx/001help.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/subx/001help.cc b/subx/001help.cc
index 65e291c5..efb3ac46 100644
--- a/subx/001help.cc
+++ b/subx/001help.cc
@@ -226,12 +226,18 @@ int feenableexcept(unsigned int excepts) {
 // from http://stackoverflow.com/questions/152643/idiomatic-c-for-reading-from-a-const-map
 template<typename T> typename T::mapped_type& get(T& map, typename T::key_type const& key) {
   typename T::iterator iter(map.find(key));
-  assert(iter != map.end());
+  if (iter == map.end()) {
+    cerr << "get couldn't find key '" << key << "'\n";
+    assert(iter != map.end());
+  }
   return iter->second;
 }
 template<typename T> typename T::mapped_type const& get(const T& map, typename T::key_type const& key) {
   typename T::const_iterator iter(map.find(key));
-  assert(iter != map.end());
+  if (iter == map.end()) {
+    cerr << "get couldn't find key '" << key << "'\n";
+    assert(iter != map.end());
+  }
   return iter->second;
 }
 template<typename T> typename T::mapped_type const& put(T& map, typename T::key_type const& key, typename T::mapped_type const& value) {