[lldb/Symbol] Fix null-deref in TypeList::Dump

This patch should just a crash caused by a null pointer dereferencing
when dumping a type. It makes sure that the pointer is valid.

rdar://97455134

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
Med Ismail Bennani 2022-08-11 17:54:41 -07:00
parent edc77353da
commit 6c58f12d07
1 changed files with 3 additions and 3 deletions

View File

@ -92,9 +92,9 @@ void TypeList::ForEach(
} }
void TypeList::Dump(Stream *s, bool show_context) { void TypeList::Dump(Stream *s, bool show_context) {
for (iterator pos = m_types.begin(), end = m_types.end(); pos != end; ++pos) { for (iterator pos = m_types.begin(), end = m_types.end(); pos != end; ++pos)
pos->get()->Dump(s, show_context); if (Type *t = pos->get())
} t->Dump(s, show_context);
} }
void TypeList::RemoveMismatchedTypes(llvm::StringRef qualified_typename, void TypeList::RemoveMismatchedTypes(llvm::StringRef qualified_typename,