summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/invent.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2014-05-29 01:36:44 -0400
committerNeil Moore <neil@s-z.org>2014-05-29 02:22:32 -0400
commit8ea69f7e867fccf0acf756bc98f7058873387266 (patch)
tree556c3c2cc9c5c95efeb031fd3192fd74c0303ca5 /crawl-ref/source/invent.cc
parentfd0d25c0593878d0c0d40fda8cb69f45453ddc1f (diff)
downloadcrawl-ref-8ea69f7e867fccf0acf756bc98f7058873387266.tar.gz
crawl-ref-8ea69f7e867fccf0acf756bc98f7058873387266.zip
Avoid a bounds error when menu items have no hotkeys.
Diffstat (limited to 'crawl-ref/source/invent.cc')
-rw-r--r--crawl-ref/source/invent.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index efe1a12cee..eea90d777d 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -196,7 +196,10 @@ string InvEntry::get_text(bool need_cursor) const
ostringstream tstr;
- tstr << ' ' << static_cast<char>(hotkeys[0]);
+ const bool nosel = hotkeys.empty();
+ const char key = nosel ? ' ' : static_cast<char>(hotkeys[0]);
+
+ tstr << ' ' << key;
if (need_cursor)
tstr << '[';