Skip to content

Commit

Permalink
Merge pull request #488 from ably/mute-method-channel-errors
Browse files Browse the repository at this point in the history
fix: prevent app crash during method channel call
  • Loading branch information
ttypic authored Oct 24, 2023
2 parents b23c870 + 7472d46 commit 801eb34
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 801eb34

Please sign in to comment.