From 467ab7b8d00e0a676527b0c7df3ad0d02a1be22d Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Mon, 12 Nov 2012 18:00:29 +0000 Subject: [PATCH] Fixed a potential crash in the Darwin platform. llvm-svn: 167732 --- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 4391e68..3f6ae9a 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -58,6 +58,9 @@ PlatformDarwin::LocateExecutableScriptingResource (const ModuleSpec &module_spec const char* module_directory = exec_fspec->GetDirectory().GetCString(); const char* module_basename = exec_fspec->GetFileNameStrippingExtension().GetCString(); + if (!module_directory || !module_basename) + return FileSpec(); + Timer scoped_timer (__PRETTY_FUNCTION__, "LocateExecutableScriptingResource (file = %s, arch = %s, uuid = %p)", exec_fspec ? exec_fspec->GetFilename().AsCString ("") : "", @@ -75,7 +78,7 @@ PlatformDarwin::LocateExecutableScriptingResource (const ModuleSpec &module_spec { // for OSX we are going to be in .dSYM/Contents/Resources/DWARF/ // let us go to .dSYM/Contents/Resources/Python/.py and see if the file exists - path_string.Printf("%s/../Python/%s.py",symbol_fspec.GetDirectory().GetCString(),module_basename); + path_string.Printf("%s/../Python/%s.py",symbol_fspec.GetDirectory().AsCString(""),module_basename); script_fspec.SetFile(path_string.GetData(), true); if (!script_fspec.Exists()) script_fspec.Clear(); -- 2.7.4