summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/acr.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-25 14:05:53 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-25 14:05:53 +0000
commite7c403614a215df6ba9074c5b0805ec3052d426e (patch)
tree219f05602dae32e10d5c590934b69d4434e65245 /crawl-ref/source/acr.cc
parent4779ce0e5239186180f9139678ef090b0fc7b856 (diff)
downloadcrawl-ref-e7c403614a215df6ba9074c5b0805ec3052d426e.tar.gz
crawl-ref-e7c403614a215df6ba9074c5b0805ec3052d426e.zip
Guard against referncing repeat_again_rec.keys[0] if the queue is empty.
Reset previous command state if a repeated command is interrupt by a key press. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7607 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/acr.cc')
-rw-r--r--crawl-ref/source/acr.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 16f528d3e8..613ea17f5a 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -1415,7 +1415,9 @@ static void _input()
{
// User pressed a key, so stop repeating commands and discard
// the keypress.
- crawl_state.cancel_cmd_repeat();
+ crawl_state.cancel_cmd_repeat("Key pressed, interrupting command "
+ "repetition.");
+ crawl_state.prev_cmd = CMD_NO_CMD;
getchm();
return;
}
@@ -4285,7 +4287,8 @@ static void _setup_cmd_repeat()
{
repeat_again_rec.keys.pop_front();
}
- while (repeat_again_rec.keys[0] != ch);
+ while (repeat_again_rec.keys.size() > 0
+ && repeat_again_rec.keys[0] != ch);
repeat_again_rec.keys.pop_front();
}