<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
This commit is contained in:
Enrico Granata 2012-10-01 17:19:37 +00:00
parent f611fcf2c3
commit e00af8093c
1 changed files with 4 additions and 6 deletions

View File

@ -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;