Skip to content

Commit e7bb1b1

Browse files
Merge pull request #3052 from adrian-prantl/79517301-5.5
Add missing nullptr check and error logging
2 parents 35aac30 + ae80a2d commit e7bb1b1

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,18 @@ static void AddRequiredAliases(Block *block, lldb::StackFrameSP &stack_frame_sp,
586586

587587
Flags imported_self_type_flags(imported_self_type.GetTypeInfo());
588588

589-
swift::Type object_type =
590-
GetSwiftType(imported_self_type)->getWithoutSpecifierType();
589+
auto swift_self_type = GetSwiftType(imported_self_type);
590+
if (!swift_self_type) {
591+
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TYPES |
592+
LIBLLDB_LOG_EXPRESSIONS));
593+
if (log)
594+
log->Printf("Couldn't get SwiftASTContext type for self type %s.",
595+
imported_self_type.GetDisplayTypeName().AsCString("<unknown>"));
596+
597+
return;
598+
}
599+
600+
swift::Type object_type = swift_self_type->getWithoutSpecifierType();
591601

592602
if (object_type.getPointer() &&
593603
(object_type.getPointer() != imported_self_type.GetOpaqueQualType()))

0 commit comments

Comments
 (0)