Skip to content

Commit d0e1749

Browse files
committed
[Sema] Add missing null check for getAttachedResultBuilder
I haven't been able to come up with a test case, but it seems like it's possible for the attribute to be invalidated during the call to `visitCustomAttr`, in which case `getAttachedResultBuilder` can return `nullptr`. rdar://118642163
1 parent 6a3ead3 commit d0e1749

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4638,7 +4638,7 @@ void AttributeChecker::visitCustomAttr(CustomAttr *attr) {
46384638

46394639
// Complain if this isn't the primary result-builder attribute.
46404640
auto attached = decl->getAttachedResultBuilder();
4641-
if (attached != attr) {
4641+
if (attached && attached != attr) {
46424642
diagnose(attr->getLocation(), diag::result_builder_multiple,
46434643
isa<ParamDecl>(decl));
46444644
diagnose(attached->getLocation(), diag::previous_result_builder_here);

0 commit comments

Comments
 (0)