From dc5ae3c20fac12aedc7251a26136f48ca8d78772 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 26 Jul 2017 20:04:31 -0700 Subject: [PATCH] Do not send messages if the platform view has been detached (flutter/engine#3927) --- .../shell/platform/android/io/flutter/view/FlutterView.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java index 62e0fbfc8e..1ebfad1bb1 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java @@ -816,6 +816,11 @@ public class FlutterView extends SurfaceView @Override public void send(String channel, ByteBuffer message, BinaryReply callback) { + if (!isAttached()) { + Log.d("flutter", "FlutterView.send called on a detached view, channel=" + channel); + return; + } + int replyId = 0; if (callback != null) { replyId = mNextReplyId++;