Skip to content

Commit 812872f

Browse files
committed
Add missing nullptr check
1 parent a1b756a commit 812872f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeRemoteAST.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ SwiftLanguageRuntimeImpl::GetMemberVariableOffsetRemoteAST(
8484
llvm::StringRef member_name) {
8585
auto scratch_ctx =
8686
instance_type.GetTypeSystem().dyn_cast_or_null<SwiftASTContext>();
87-
if (scratch_ctx == nullptr || scratch_ctx->HasFatalErrors())
87+
if (!scratch_ctx || scratch_ctx->HasFatalErrors())
8888
return {};
8989

9090
auto *remote_ast = &GetRemoteASTContext(*scratch_ctx);
9191
// Check whether we've already cached this offset.
9292
swift::TypeBase *swift_type =
9393
scratch_ctx->GetCanonicalSwiftType(instance_type).getPointer();
94-
if (swift_type == nullptr)
94+
if (!swift_type)
9595
return {};
9696

9797
// Perform the cache lookup.
@@ -143,6 +143,9 @@ SwiftLanguageRuntimeImpl::GetMemberVariableOffsetRemoteAST(
143143
}
144144
}
145145

146+
if (!swift_type)
147+
return {};
148+
146149
// Try to determine whether it is safe to use RemoteAST. RemoteAST
147150
// is faster than RemoteMirrors, but can't do dynamic types (checked
148151
// inside RemoteAST) or incomplete types (checked here).

0 commit comments

Comments
 (0)