Fixing a crashing bug in multiword commands from William Lynch.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@108958 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectMultiword.cpp b/source/Commands/CommandObjectMultiword.cpp
index 9e02d9e..ed118f7 100644
--- a/source/Commands/CommandObjectMultiword.cpp
+++ b/source/Commands/CommandObjectMultiword.cpp
@@ -290,13 +290,12 @@
const char *
CommandObjectMultiword::GetRepeatCommand (Args ¤t_command_args, uint32_t index)
{
- if (current_command_args.GetArgumentCount() == 0)
- return NULL;
index++;
+ if (current_command_args.GetArgumentCount() <= index)
+ return NULL;
CommandObject *sub_command_object = GetSubcommandObject (current_command_args.GetArgumentAtIndex(index));
if (sub_command_object == NULL)
return NULL;
- else
return sub_command_object->GetRepeatCommand(current_command_args, index);
}