Fix small bugs:

- Make sure cmd_obj & cmd_obj_sp contain a valid objects before attempting to 
dereference, in CommandObjectCommandsAlias::Execute and 
CommandInterpreter::HandleCommand.

- Modify CommandInterpreter::GetCommandSPExact to properly handle
multi-word command inputs.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121779 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectCommands.cpp b/source/Commands/CommandObjectCommands.cpp
index 0d2c55c..e2358bd 100644
--- a/source/Commands/CommandObjectCommands.cpp
+++ b/source/Commands/CommandObjectCommands.cpp
@@ -359,10 +359,18 @@
             }
             
             CommandObjectSP cmd_obj_sp = m_interpreter.GetCommandSPExact (cmd_obj->GetCommandName(), false);
-            m_interpreter.AddAlias (alias_command.c_str(), cmd_obj_sp);
-            if (option_arg_vector->size() > 0)
-                m_interpreter.AddOrReplaceAliasOptions (alias_command.c_str(), option_arg_vector_sp);
-            result.SetStatus (eReturnStatusSuccessFinishNoResult);
+            if (cmd_obj_sp)
+            {
+                m_interpreter.AddAlias (alias_command.c_str(), cmd_obj_sp);
+                if (option_arg_vector->size() > 0)
+                    m_interpreter.AddOrReplaceAliasOptions (alias_command.c_str(), option_arg_vector_sp);
+                result.SetStatus (eReturnStatusSuccessFinishNoResult);
+            }
+            else
+            {
+                result.AppendError ("Unable to create requested alias.\n");
+                result.SetStatus (eReturnStatusFailed);
+            }
         }
         return result.Succeeded();
     }