Skip to content

Commit 4bf682c

Browse files
committed
Fix an issue found with UBSAN where we call walk() with a nullptr for 'this'.
Fixes: rdar://problem/43657456
1 parent 01a0de2 commit 4bf682c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Sema/TypeCheckCaptures.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -707,6 +707,9 @@ void TypeChecker::computeCaptures(AnyFunctionRef AFR) {
707707
if (AFR.getCaptureInfo().hasBeenComputed())
708708
return;
709709

710+
if (!AFR.getBody())
711+
return;
712+
710713
SmallVector<CapturedValue, 4> Captures;
711714
SourceLoc GenericParamCaptureLoc;
712715
SourceLoc DynamicSelfCaptureLoc;

0 commit comments

Comments
 (0)