When completing "help foo bar" if "foo" is not a real command, don't ask its NULL command object to complete the line.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@143047 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectHelp.cpp b/source/Commands/CommandObjectHelp.cpp
index dd68f7c..e735c66 100644
--- a/source/Commands/CommandObjectHelp.cpp
+++ b/source/Commands/CommandObjectHelp.cpp
@@ -263,14 +263,31 @@
else
{
CommandObject *cmd_obj = m_interpreter.GetCommandObject (input.GetArgumentAtIndex(0));
- input.Shift();
- cursor_index--;
- return cmd_obj->HandleCompletion (input,
- cursor_index,
- cursor_char_position,
- match_start_point,
- max_return_elements,
- word_complete,
- matches);
+
+ // The command that they are getting help on might be ambiguous, in which case we should complete that,
+ // otherwise complete with the command the user is getting help on...
+
+ if (cmd_obj)
+ {
+ input.Shift();
+ cursor_index--;
+ return cmd_obj->HandleCompletion (input,
+ cursor_index,
+ cursor_char_position,
+ match_start_point,
+ max_return_elements,
+ word_complete,
+ matches);
+ }
+ else
+ {
+ return m_interpreter.HandleCompletionMatches (input,
+ cursor_index,
+ cursor_char_position,
+ match_start_point,
+ max_return_elements,
+ word_complete,
+ matches);
+ }
}
}