Skip to content

Commit

Permalink
fix: prevent app crash during method channel call
Browse files Browse the repository at this point in the history
* mute IllegalStateException during `result.success` call
* Log method that throws it
  • Loading branch information
ttypic committed Oct 24, 2023
1 parent b23c870 commit 7472d46
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,12 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result
// We don't have a handler for a method with this name so tell the caller.
result.notImplemented();
} else {
// We have a handler for a method with this name so delegate to it.
handler.accept(call, result);
try {
// We have a handler for a method with this name so delegate to it.
handler.accept(call, result);
} catch (Exception e) {
Log.e(TAG, String.format("\"%s\" platform method received error during invocation", call.method), e);
}
}
}

Expand Down

0 comments on commit 7472d46

Please sign in to comment.