summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dbg-util.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2010-08-09 11:51:24 +0200
committerRobert Vollmert <rvollmert@gmx.net>2010-08-09 11:51:24 +0200
commite4c5614259676896cf311261378216078ce49090 (patch)
tree220f7f27c3f0ae6625d9f0721044d01da9edf668 /crawl-ref/source/dbg-util.cc
parent247023163c7063d129eb667b92ff4249337b05ab (diff)
downloadcrawl-ref-e4c5614259676896cf311261378216078ce49090.tar.gz
crawl-ref-e4c5614259676896cf311261378216078ce49090.zip
Make crash level gen dump not crash on empty vault table.
CrawlHashTable::const_iterator assumes hash_map != NULL (it probably shouldn't). This doesn't fix that, but should prevent crashes when the vault table does have hash_map == NULL.
Diffstat (limited to 'crawl-ref/source/dbg-util.cc')
-rw-r--r--crawl-ref/source/dbg-util.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/crawl-ref/source/dbg-util.cc b/crawl-ref/source/dbg-util.cc
index 3647f72aad..3602b6ca25 100644
--- a/crawl-ref/source/dbg-util.cc
+++ b/crawl-ref/source/dbg-util.cc
@@ -115,11 +115,15 @@ void debug_dump_levgen()
else
{
const CrawlHashTable &vaults = props[LEVEL_VAULTS_KEY].get_table();
- CrawlHashTable::const_iterator i = vaults.begin();
+ // const_iterator asserts if the table has hash_map == NULL
+ if (!vaults.empty())
+ {
+ CrawlHashTable::const_iterator i = vaults.begin();
- for (; i != vaults.end(); ++i)
- mprf(" %s: %s", i->first.c_str(),
- i->second.get_string().c_str());
+ for (; i != vaults.end(); ++i)
+ mprf(" %s: %s", i->first.c_str(),
+ i->second.get_string().c_str());
+ }
}
mpr("");
}