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
This commit is contained in:
Sean Callanan
2012-12-03 21:28:37 +00:00
parent e2b6d08459
commit 811209be11

View File

@@ -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();