diff options
author | Willem Jan Palenstijn | 2009-07-18 22:17:56 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2009-07-18 22:17:56 +0000 |
commit | 66b565c9c2db447b3080d781ca60c12f78348dbf (patch) | |
tree | b8045904c570d6e05764595ea998c8bb8320a31b | |
parent | d362ca86f6fbb4c4f12485ed3ef013713709bd9a (diff) | |
download | scummvm-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.cpp | 3 |
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()) |