about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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) {