diff options
author | Sean Callanan <scallanan@apple.com> | 2012-12-03 21:28:37 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2012-12-03 21:28:37 +0000 |
commit | 811209be115d9d039d47aec0135f0629831cd53e (patch) | |
tree | 88a768359523790d4fd0a33e0b83f66c9346ee8a /lldb/source/Interpreter/ScriptInterpreterPython.cpp | |
parent | e2b6d084598406dfaafeed9b3552892cb42215ef (diff) | |
download | bcm5719-llvm-811209be115d9d039d47aec0135f0629831cd53e.tar.gz bcm5719-llvm-811209be115d9d039d47aec0135f0629831cd53e.zip |
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>
llvm-svn: 169156
Diffstat (limited to 'lldb/source/Interpreter/ScriptInterpreterPython.cpp')
-rw-r--r-- | lldb/source/Interpreter/ScriptInterpreterPython.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index b23cda3ccbf..ac0baf449bf 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -2493,10 +2493,13 @@ ScriptInterpreterPython::LoadScriptingModule (const char* pathname, // 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(); |