[Lldb-commits] [lldb] r169156 - /lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

Sean Callanan scallanan at apple.com
Mon Dec 3 13:28:38 PST 2012


Author: spyffe
Date: Mon Dec  3 15:28:37 2012
New Revision: 169156

URL: http://llvm.org/viewvc/llvm-project?rev=169156&view=rev
Log:
Fixed a crash in which we examined the extension of
a file name, whether the file name had an extension
or not.

<rdar://problem/12793152>

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

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=169156&r1=169155&r2=169156&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Mon Dec  3 15:28:37 2012
@@ -2493,10 +2493,13 @@
         
         // strip .py or .pyc extension
         ConstString extension = target_file.GetFileNameExtension();
-        if (::strcmp(extension.GetCString(), "py") == 0)
-            basename.resize(basename.length()-3);
-        else if(::strcmp(extension.GetCString(), "pyc") == 0)
-            basename.resize(basename.length()-4);
+        if (extension)
+        {
+            if (::strcmp(extension.GetCString(), "py") == 0)
+                basename.resize(basename.length()-3);
+            else if(::strcmp(extension.GetCString(), "pyc") == 0)
+                basename.resize(basename.length()-4);
+        }
         
         // check if the module is already import-ed
         command_stream.Clear();





More information about the lldb-commits mailing list