aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2017-09-28 20:03:20 +0200
committerWillem Jan Palenstijn2017-09-29 18:11:10 +0200
commit078e3b43be37218a6aa8aed0989aa49b06137a20 (patch)
tree465163ad54e7f9336431c57b510928391edf5e59
parent74f69ef4005c0aa4fcd1b4c54b0443b5e38c4da0 (diff)
downloadscummvm-rg350-078e3b43be37218a6aa8aed0989aa49b06137a20.tar.gz
scummvm-rg350-078e3b43be37218a6aa8aed0989aa49b06137a20.tar.bz2
scummvm-rg350-078e3b43be37218a6aa8aed0989aa49b06137a20.zip
GUI: Fix crash after empty debugger command
-rw-r--r--gui/debugger.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/gui/debugger.cpp b/gui/debugger.cpp
index 1de322ae93..b18e50b824 100644
--- a/gui/debugger.cpp
+++ b/gui/debugger.cpp
@@ -276,6 +276,8 @@ void Debugger::enter() {
}
bool Debugger::handleCommand(int argc, const char **argv, bool &result) {
+ assert(argc > 0);
+
if (_cmds.contains(argv[0])) {
assert(_cmds[argv[0]]);
result = (*_cmds[argv[0]])(argc, argv);
@@ -295,6 +297,9 @@ bool Debugger::parseCommand(const char *inputOrig) {
char *input = strdup(inputOrig);
splitCommand(input, num_params, &param[0]);
+ if (num_params == 0)
+ return true;
+
// Handle commands first
bool result;
if (handleCommand(num_params, param, result)) {