Skip to content

Commit 7323cab

Browse files
committed
Add missing nullptr check
(cherry picked from commit 812872f) Conflicts: lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeRemoteAST.cpp
1 parent 819b32d commit 7323cab

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
@@ -83,14 +83,14 @@ SwiftLanguageRuntimeImpl::GetMemberVariableOffsetRemoteAST(
8383
llvm::StringRef member_name) {
8484
auto scratch_ctx =
8585
instance_type.GetTypeSystem().dyn_cast_or_null<SwiftASTContext>();
86-
if (scratch_ctx == nullptr || scratch_ctx->HasFatalErrors())
86+
if (!scratch_ctx || scratch_ctx->HasFatalErrors())
8787
return {};
8888

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

9696
// Perform the cache lookup.
@@ -142,6 +142,9 @@ SwiftLanguageRuntimeImpl::GetMemberVariableOffsetRemoteAST(
142142
}
143143
}
144144

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

0 commit comments

Comments
 (0)