From 3c8bcea19e666fea1fbc96f978da5d3b053d6d56 Mon Sep 17 00:00:00 2001 From: yangbingqiao Date: Fri, 15 Apr 2022 19:16:35 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E6=97=B6bitmap=E5=8F=AF=E8=83=BD=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84=E5=B4=A9=E6=BA=83=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../finogeeks/mop/api/mop/AppletHandlerModule.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/android/src/main/java/com/finogeeks/mop/api/mop/AppletHandlerModule.java b/android/src/main/java/com/finogeeks/mop/api/mop/AppletHandlerModule.java index a6179c5..8b65c24 100644 --- a/android/src/main/java/com/finogeeks/mop/api/mop/AppletHandlerModule.java +++ b/android/src/main/java/com/finogeeks/mop/api/mop/AppletHandlerModule.java @@ -23,12 +23,12 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.json.JSONObject; +import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CountDownLatch; -import java.io.ByteArrayOutputStream; import io.flutter.plugin.common.MethodChannel; @@ -63,10 +63,12 @@ public class AppletHandlerModule extends BaseApi { Map params = new HashMap<>(); params.put("appletInfo", GsonUtil.gson.fromJson(s, new TypeToken>() { }.getType())); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos); - byte[] data = baos.toByteArray(); - params.put("bitmap", data); + if (bitmap != null) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos); + byte[] data = baos.toByteArray(); + params.put("bitmap", data); + } handler.post(() -> { channel.invokeMethod("extensionApi:forwardApplet", params, new MethodChannel.Result() { @Override