diff options
-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()) |