diff --git a/clang/lib/Analysis/FlowSensitive/Transfer.cpp b/clang/lib/Analysis/FlowSensitive/Transfer.cpp index b510114a7a355..2414a1cc026af 100644 --- a/clang/lib/Analysis/FlowSensitive/Transfer.cpp +++ b/clang/lib/Analysis/FlowSensitive/Transfer.cpp @@ -531,17 +531,18 @@ class TransferVisitor : public ConstStmtVisitor { auto *LocDst = cast_or_null(Env.getStorageLocation(*Arg0)); + if (LocSrc == nullptr || LocDst == nullptr) + return; + // The assignment operators are different from the type of the destination - // in this model (i.e. in one of their base classes). This must be very rare - // and we just bail. + // in this model (i.e. in one of their base classes). This must be very + // rare and we just bail. if (Method->getThisObjectType().getCanonicalType().getUnqualifiedType() != LocDst->getType().getCanonicalType().getUnqualifiedType()) return; - if (LocSrc != nullptr && LocDst != nullptr) { - copyRecord(*LocSrc, *LocDst, Env); - Env.setStorageLocation(*S, *LocDst); - } + copyRecord(*LocSrc, *LocDst, Env); + Env.setStorageLocation(*S, *LocDst); } }