From 811209be115d9d039d47aec0135f0629831cd53e Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Mon, 3 Dec 2012 21:28:37 +0000 Subject: [PATCH] Fixed a crash in which we examined the extension of a file name, whether the file name had an extension or not. llvm-svn: 169156 --- lldb/source/Interpreter/ScriptInterpreterPython.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index b23cda3..ac0baf4 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(); -- 2.7.4