From 232f4636e5d46df1f8ba2857c8668558afa697a5 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 (#3927) --- shell/platform/android/io/flutter/view/FlutterView.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 62e0fbfc8ee..1ebfad1bb1c 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/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++;