From 872e06256626b26bd8b3f22de8b93b6296e91037 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Mon, 19 Dec 2011 21:16:29 +0000 Subject: Work in progress for: rdar://problem/10577182 Audit lldb API impl for places where we need to perform a NULL check Add NULL checks for SBCommandInterpreter APIs. llvm-svn: 146909 --- lldb/source/API/SBCommandInterpreter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lldb/source/API/SBCommandInterpreter.cpp') diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index fe514cbbc11..03f33c69db0 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -65,7 +65,7 @@ SBCommandInterpreter::IsValid() const bool SBCommandInterpreter::CommandExists (const char *cmd) { - if (m_opaque_ptr) + if (cmd && m_opaque_ptr) return m_opaque_ptr->CommandExists (cmd); return false; } @@ -73,7 +73,7 @@ SBCommandInterpreter::CommandExists (const char *cmd) bool SBCommandInterpreter::AliasExists (const char *cmd) { - if (m_opaque_ptr) + if (cmd && m_opaque_ptr) return m_opaque_ptr->AliasExists (cmd); return false; } @@ -88,7 +88,7 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb m_opaque_ptr, command_line, result.get(), add_to_history); result.Clear(); - if (m_opaque_ptr) + if (command_line && m_opaque_ptr) { TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget()); Mutex::Locker api_locker; @@ -98,7 +98,7 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb } else { - result->AppendError ("SBCommandInterpreter is not valid"); + result->AppendError ("SBCommandInterpreter or the command line is not valid"); result->SetStatus (eReturnStatusFailed); } -- cgit v1.2.3