From 9e916e8096e349cb3fb658411a59bf0b4896d9d2 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Wed, 10 Aug 2011 17:58:11 +0000 Subject: Check log shared pointer before using it. llvm-svn: 137228 --- lldb/source/Target/ThreadPlanCallFunction.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'lldb/source/Target/ThreadPlanCallFunction.cpp') diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index 07608726908..8ec93b98735 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -69,7 +69,8 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, if (!executableModuleSP) { - log->Printf ("Can't execute code without an executable module."); + if (log) + log->Printf ("Can't execute code without an executable module."); return; } else @@ -77,15 +78,17 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, ObjectFile *objectFile = executableModuleSP->GetObjectFile(); if (!objectFile) { - log->Printf ("Could not find object file for module \"%s\".", - executableModuleSP->GetFileSpec().GetFilename().AsCString()); + if (log) + log->Printf ("Could not find object file for module \"%s\".", + executableModuleSP->GetFileSpec().GetFilename().AsCString()); return; } m_start_addr = objectFile->GetEntryPointAddress(); if (!m_start_addr.IsValid()) { - log->Printf ("Could not find entry point address for executable module \"%s\".", - executableModuleSP->GetFileSpec().GetFilename().AsCString()); + if (log) + log->Printf ("Could not find entry point address for executable module \"%s\".", + executableModuleSP->GetFileSpec().GetFilename().AsCString()); return; } } @@ -182,7 +185,8 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, if (!executableModuleSP) { - log->Printf ("Can't execute code without an executable module."); + if (log) + log->Printf ("Can't execute code without an executable module."); return; } else @@ -190,8 +194,9 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, ObjectFile *objectFile = executableModuleSP->GetObjectFile(); if (!objectFile) { - log->Printf ("Could not find object file for module \"%s\".", - executableModuleSP->GetFileSpec().GetFilename().AsCString()); + if (log) + log->Printf ("Could not find object file for module \"%s\".", + executableModuleSP->GetFileSpec().GetFilename().AsCString()); return; } m_start_addr = objectFile->GetEntryPointAddress(); -- cgit v1.2.3