diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2010-08-09 11:51:24 +0200 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2010-08-09 11:51:24 +0200 |
commit | e4c5614259676896cf311261378216078ce49090 (patch) | |
tree | 220f7f27c3f0ae6625d9f0721044d01da9edf668 /crawl-ref/source/dbg-util.cc | |
parent | 247023163c7063d129eb667b92ff4249337b05ab (diff) | |
download | crawl-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.cc | 12 |
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(""); } |