Skip to content

Commit 453afd6

Browse files
authored
[macos] early return to suppress clang-tidy warning (flutter/engine#56588)
If we disable the NSAssert during release mode, this code will continue after NSAssert failure, which will then pass a `nil` value into a dictionary (which cannot have a nil value), hence the clang-tidy warning here flutter/engine#53005 (comment) *List which issues are fixed by this PR. You must list at least one issue.* flutter#148279 flutter#157837 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
1 parent 08b52b4 commit 453afd6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,13 @@ - (void)handleEvent:(NSEvent*)event callback:(FlutterAsyncKeyCallback)callback {
131131
return;
132132
}
133133
break;
134-
default: {
135-
NSAssert(false, @"Unexpected key event type (got %lu).", event.type);
136-
callback(false);
137-
}
134+
default:
135+
[[unlikely]] {
136+
NSAssert(false, @"Unexpected key event type (got %lu).", event.type);
137+
callback(false);
138+
// This should not happen. Return to suppress clang-tidy warning on `type` being nil.
139+
return;
140+
}
138141
}
139142
_previouslyPressedFlags = modifierFlags;
140143
NSMutableDictionary* keyMessage = [@{

0 commit comments

Comments
 (0)