Check the result of creating a node from __next_ in the std::list formatter.

There's a single report of a crash coming from this current_sp being NULL.  I don't
have a repro case, and I couldn't get it to happen by hand-corrupting a list.  We
always get an error instead.  So I don't have a test case.  But checking for null
is clearly right here.

<rdar://problem/48503320>

llvm-svn: 355957
This commit is contained in:
Jim Ingham 2019-03-12 19:27:39 +00:00
parent 2ca0ebf6b4
commit 027bf7603f
1 changed files with 3 additions and 1 deletions

View File

@ -384,7 +384,7 @@ lldb::ValueObjectSP ListFrontEnd::GetChildAtIndex(size_t idx) {
if (current_sp->GetName() == g_next) {
ProcessSP process_sp(current_sp->GetProcessSP());
if (!process_sp)
return nullptr;
return lldb::ValueObjectSP();
// if we grabbed the __next_ pointer, then the child is one pointer deep-er
lldb::addr_t addr = current_sp->GetParent()->GetPointerValue();
@ -392,6 +392,8 @@ lldb::ValueObjectSP ListFrontEnd::GetChildAtIndex(size_t idx) {
ExecutionContext exe_ctx(process_sp);
current_sp =
CreateValueObjectFromAddress("__value_", addr, exe_ctx, m_element_type);
if (!current_sp)
return lldb::ValueObjectSP();
}
// we need to copy current_sp into a new object otherwise we will end up with