summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/ScriptInterpreterPython.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Interpreter/ScriptInterpreterPython.cpp')
-rw-r--r--lldb/source/Interpreter/ScriptInterpreterPython.cpp11
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();
OpenPOWER on IntegriCloud