[Lldb-commits] [lldb] r164950 - /lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Enrico Granata egranata at apple.com
Mon Oct 1 10:19:38 PDT 2012


Author: enrico
Date: Mon Oct  1 12:19:37 2012
New Revision: 164950

URL: http://llvm.org/viewvc/llvm-project?rev=164950&view=rev
Log:
<rdar://problem/12406088> Fixing a crasher with adding a regex command, due to accessing a shared pointer without first checking for NULL

Modified:
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=164950&r1=164949&r2=164950&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Mon Oct  1 12:19:37 2012
@@ -624,12 +624,10 @@
     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;





More information about the lldb-commits mailing list