aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectCommands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Commands/CommandObjectCommands.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectCommands.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index 0d2c55c9..e2358bda 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -359,10 +359,18 @@ public:
}
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();
}