diff options
author | Adam Borowski <kilobyte@angband.pl> | 2011-09-19 11:32:20 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2011-09-19 11:32:20 +0200 |
commit | 304cd6d8e2b64a9d44995049e1ca3c65768eeea8 (patch) | |
tree | 71368a22d3ed3811af06708c213f79dab6d853b7 /crawl-ref/source/store.cc | |
parent | 786963fadc3d2725eec4990eed772a69ca1d0b69 (diff) | |
download | crawl-ref-304cd6d8e2b64a9d44995049e1ca3c65768eeea8.tar.gz crawl-ref-304cd6d8e2b64a9d44995049e1ca3c65768eeea8.zip |
A more helpful crash message on non-existant prop asserts.
Diffstat (limited to 'crawl-ref/source/store.cc')
-rw-r--r-- | crawl-ref/source/store.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crawl-ref/source/store.cc b/crawl-ref/source/store.cc index 295848dfae..f2368db4f9 100644 --- a/crawl-ref/source/store.cc +++ b/crawl-ref/source/store.cc @@ -1442,12 +1442,18 @@ CrawlStoreValue& CrawlHashTable::get_value(const std::string &key) const CrawlStoreValue& CrawlHashTable::get_value(const std::string &key) const { - ASSERT(hash_map != NULL); +#ifdef ASSERTS + if (!hash_map) + die("trying to read non-existant property \"%s\"", key.c_str()); +#endif assert_validity(); hash_map_type::const_iterator i = hash_map->find(key); - ASSERT(i != hash_map->end()); +#ifdef ASSERTS + if (i == hash_map->end()) + die("trying to read non-existant property \"%s\"", key.c_str()); +#endif ASSERT(i->second.type != SV_NONE); ASSERT(!(i->second.flags & SFLAG_UNSET)); |