summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2012-10-01 17:19:37 +0000
committerEnrico Granata <egranata@apple.com>2012-10-01 17:19:37 +0000
commite00af8093c2fc454dc3d2f1987e16c5fc64ed8e8 (patch)
treeaaafdd519473fe3f62cfdc49c3e1c6eac8106deb /lldb/source/Interpreter/CommandInterpreter.cpp
parentf611fcf2c3ab16e6d2367fe41e356b6794d38f37 (diff)
downloadbcm5719-llvm-e00af8093c2fc454dc3d2f1987e16c5fc64ed8e8.tar.gz
bcm5719-llvm-e00af8093c2fc454dc3d2f1987e16c5fc64ed8e8.zip
<rdar://problem/12406088> Fixing a crasher with adding a regex command, due to accessing a shared pointer without first checking for NULL
llvm-svn: 164950
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index eed403866ae..44ba511ed5b 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -624,12 +624,10 @@ CommandInterpreter::AddCommand (const char *name, const lldb::CommandObjectSP &c
if (name && name[0])
{
std::string name_sstr(name);
- if (!can_replace)
- {
- if (m_command_dict.find (name_sstr) != m_command_dict.end())
- return false;
- }
- if (m_command_dict[name_sstr]->IsRemovable() == false)
+ bool found = (m_command_dict.find (name_sstr) != m_command_dict.end());
+ if (found && !can_replace)
+ return false;
+ if (found && m_command_dict[name_sstr]->IsRemovable() == false)
return false;
m_command_dict[name_sstr] = cmd_sp;
return true;
OpenPOWER on IntegriCloud