Skip to content

Commit cdc1e75

Browse files
Address review comments
1 parent 2354f98 commit cdc1e75

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

plugins/color_panel/macos/FLEColorPanelPlugin.mm

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ - (instancetype)initWithChannel:(FLEMethodChannel *)channel {
4545
* panel channel.
4646
*/
4747
- (void)handleMethodCall:(FLEMethodCall *)call result:(FLEMethodResult)result {
48-
BOOL methodImplemented = YES;
48+
id methodResult = nil;
4949
if ([call.methodName isEqualToString:@(plugins_color_panel::kShowColorPanelMethod)]) {
5050
if ([call.arguments isKindOfClass:[NSDictionary class]]) {
5151
BOOL showAlpha =
@@ -56,19 +56,18 @@ - (void)handleMethodCall:(FLEMethodCall *)call result:(FLEMethodResult)result {
5656
[NSString stringWithFormat:@"Malformed call for %@. Expected an NSDictionary but got %@",
5757
@(plugins_color_panel::kShowColorPanelMethod),
5858
NSStringFromClass([call.arguments class])];
59-
result([[FLEMethodError alloc] initWithCode:@"error"
60-
message:@"Bad arguments"
61-
details:errorString]);
62-
return;
59+
methodResult = [[FLEMethodError alloc] initWithCode:@"Bad arguments"
60+
message:errorString
61+
details:nil];
6362
}
6463
} else if ([call.methodName isEqualToString:@(plugins_color_panel::kHideColorPanelMethod)]) {
6564
[self hideColorPanel];
6665
} else {
67-
methodImplemented = NO;
66+
methodResult = FLEMethodNotImplemented;
6867
}
69-
// Send an immediate empty success message for handled messages, since the actual color data
70-
// will be provided in follow-up messages.
71-
result(methodImplemented ? nil : FLEMethodNotImplemented);
68+
// If no errors are generated, send an immediate empty success message for handled messages, since
69+
// the actual color data will be provided in follow-up messages.
70+
result(methodResult);
7271
}
7372

7473
/**

0 commit comments

Comments
 (0)