Skip to content

Commit

Permalink
Log instead of asserting when sending a reply message to a defunct en…
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons authored Sep 11, 2017
1 parent 2abd7c8 commit a44146f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions shell/platform/android/io/flutter/view/FlutterView.java
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ private void updateViewportMetrics() {
}

// Called by native to send us a platform message.
private void handlePlatformMessage(String channel, byte[] message, final int replyId) {
private void handlePlatformMessage(final String channel, byte[] message, final int replyId) {
assertAttached();
BinaryMessageHandler handler = mMessageHandlers.get(channel);
if (handler != null) {
Expand All @@ -680,7 +680,10 @@ private void handlePlatformMessage(String channel, byte[] message, final int rep
private final AtomicBoolean done = new AtomicBoolean(false);
@Override
public void reply(ByteBuffer reply) {
assertAttached();
if (!isAttached()) {
Log.d(TAG, "handlePlatformMessage replying to a detached view, channel=" + channel);
return;
}
if (done.getAndSet(true)) {
throw new IllegalStateException("Reply already submitted");
}
Expand Down Expand Up @@ -864,7 +867,7 @@ public void send(String channel, ByteBuffer message) {
@Override
public void send(String channel, ByteBuffer message, BinaryReply callback) {
if (!isAttached()) {
Log.d("flutter", "FlutterView.send called on a detached view, channel=" + channel);
Log.d(TAG, "FlutterView.send called on a detached view, channel=" + channel);
return;
}

Expand Down

0 comments on commit a44146f

Please sign in to comment.