http://llvm.org/bugs/show_bug.cgi?id=11560 lldb::SBTarget::FindFirstType crashes when passed None
Add null checks to several functions. Plus add test scenario for passing None to SBTarget.FindFirstType(None) and friends.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146540 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index e8a39a9..179cb93 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -1188,7 +1188,7 @@
{
if (!append)
sc_list.Clear();
- if (m_opaque_sp)
+ if (name && m_opaque_sp)
{
const bool symbols_ok = true;
return m_opaque_sp->GetImages().FindFunctions (ConstString(name),
@@ -1203,7 +1203,7 @@
lldb::SBType
SBTarget::FindFirstType (const char* type)
{
- if (m_opaque_sp)
+ if (type && m_opaque_sp)
{
size_t count = m_opaque_sp->GetImages().GetSize();
for (size_t idx = 0; idx < count; idx++)
@@ -1223,7 +1223,7 @@
SBTypeList retval;
- if (m_opaque_sp)
+ if (type && m_opaque_sp)
{
ModuleList& images = m_opaque_sp->GetImages();
ConstString name_const(type);
@@ -1251,7 +1251,7 @@
{
SBValueList sb_value_list;
- if (m_opaque_sp)
+ if (name && m_opaque_sp)
{
VariableList variable_list;
const bool append = true;