Skip to content

Commit

Permalink
fix(ios): iterate listeners to avoid mutated while being enumerated (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
RangerRick authored Sep 24, 2020
1 parent ec086b0 commit fbaab54
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ios/Capacitor/Capacitor/CAPPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,13 @@ - (void)notifyListeners:(NSString *)eventName data:(NSDictionary<NSString *,id>
}
return;
}

for(CAPPluginCall *call in listenersForEvent) {
CAPPluginCallResult *result = [[CAPPluginCallResult alloc] init:data];
call.successHandler(result, call);

for (int i=0; i < listenersForEvent.count; i++) {
CAPPluginCall *call = listenersForEvent[i];
if (call != nil) {
CAPPluginCallResult *result = [[CAPPluginCallResult alloc] init:data];
call.successHandler(result, call);
}
}
}

Expand Down

0 comments on commit fbaab54

Please sign in to comment.