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 SBModule and SBSection APIs.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146899 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBModule.cpp b/source/API/SBModule.cpp
index a429897..c80d952 100644
--- a/source/API/SBModule.cpp
+++ b/source/API/SBModule.cpp
@@ -342,7 +342,7 @@
{
if (!append)
sc_list.Clear();
- if (m_opaque_sp)
+ if (name && m_opaque_sp)
{
const bool symbols_ok = true;
return m_opaque_sp->FindFunctions (ConstString(name),
@@ -360,7 +360,7 @@
SBModule::FindGlobalVariables (SBTarget &target, const char *name, uint32_t max_matches)
{
SBValueList sb_value_list;
- if (m_opaque_sp)
+ if (name && m_opaque_sp)
{
VariableList variable_list;
const uint32_t match_count = m_opaque_sp->FindGlobalVariables (ConstString (name),
@@ -389,10 +389,10 @@
}
lldb::SBType
-SBModule::FindFirstType (const char* name_cstr)
+SBModule::FindFirstType (const char *name_cstr)
{
SBType sb_type;
- if (IsValid())
+ if (name_cstr && IsValid())
{
SymbolContext sc;
TypeList type_list;
@@ -413,12 +413,12 @@
}
lldb::SBTypeList
-SBModule::FindTypes (const char* type)
+SBModule::FindTypes (const char *type)
{
SBTypeList retval;
- if (IsValid())
+ if (type && IsValid())
{
SymbolContext sc;
TypeList type_list;
@@ -449,7 +449,7 @@
{
SBSection sb_section;
- if (IsValid())
+ if (sect_name && IsValid())
{
ObjectFile *objfile = m_opaque_sp->GetObjectFile();
if (objfile)