aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2009-07-18 22:17:56 +0000
committerWillem Jan Palenstijn2009-07-18 22:17:56 +0000
commit66b565c9c2db447b3080d781ca60c12f78348dbf (patch)
treeb8045904c570d6e05764595ea998c8bb8320a31b
parentd362ca86f6fbb4c4f12485ed3ef013713709bd9a (diff)
downloadscummvm-rg350-66b565c9c2db447b3080d781ca60c12f78348dbf.tar.gz
scummvm-rg350-66b565c9c2db447b3080d781ca60c12f78348dbf.tar.bz2
scummvm-rg350-66b565c9c2db447b3080d781ca60c12f78348dbf.zip
Fix crash in tab completion if one command is a prefix of another.
svn-id: r42597
-rw-r--r--gui/debugger.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/gui/debugger.cpp b/gui/debugger.cpp
index 181403484b..6b55681a25 100644
--- a/gui/debugger.cpp
+++ b/gui/debugger.cpp
@@ -307,7 +307,8 @@ bool Debugger::tabComplete(const char *input, Common::String &completion) const
} else {
// take common prefix of previous match and this command
for (uint j = 0; j < completion.size(); j++) {
- if (completion[j] != i->_key[inputlen + j]) {
+ if (inputlen + j >= i->_key.size() ||
+ completion[j] != i->_key[inputlen + j]) {
completion = Common::String(completion.begin(), completion.begin() + j);
// If there is no unambiguous completion, abort
if (completion.empty())