diff options
author | Caroline Tice <ctice@apple.com> | 2010-12-14 18:51:39 +0000 |
---|---|---|
committer | Caroline Tice <ctice@apple.com> | 2010-12-14 18:51:39 +0000 |
commit | 472362e6ed6866bc6518aea7c69e52c8d1d3eb47 (patch) | |
tree | 3d70c32da4b198ea7247e36dfd6bb057ceb66602 /lldb/source/Commands/CommandObjectCommands.cpp | |
parent | 41955ff958bdb71fca4d2b55093b13114eeaed94 (diff) | |
download | llvm-472362e6ed6866bc6518aea7c69e52c8d1d3eb47.zip llvm-472362e6ed6866bc6518aea7c69e52c8d1d3eb47.tar.gz llvm-472362e6ed6866bc6518aea7c69e52c8d1d3eb47.tar.bz2 |
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.
llvm-svn: 121779
Diffstat (limited to 'lldb/source/Commands/CommandObjectCommands.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectCommands.cpp | 16 |
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(); } |