Skip to content

Commit cba8684

Browse files
committed
use dyn_cast_or_null
1 parent 9090d7f commit cba8684

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,11 +514,9 @@ static void checkForEmptyOptionSet(const VarDecl *VD, TypeChecker &tc) {
514514

515515
auto initIndex = PBD->getPatternEntryIndexForVarDecl(VD);
516516
auto init = PBD->getInit(initIndex);
517-
if (!init)
518-
return;
519517

520518
// Make sure property is being set with a constructor
521-
auto ctor = dyn_cast<CallExpr>(init);
519+
auto ctor = dyn_cast_or_null<CallExpr>(init);
522520
if (!ctor)
523521
return;
524522
auto ctorCalledVal = ctor->getCalledValue();

0 commit comments

Comments
 (0)