From e9276b804c9e221fc2dcf996c668902bf70d405d Mon Sep 17 00:00:00 2001 From: Aliaksei Astafyeu Date: Mon, 11 Dec 2023 18:30:15 +0100 Subject: [PATCH] fix crash Writable map pushMap --- .../reactnativeescposprinter/EscPosPrinterDiscoveryModule.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/android/src/main/java/com/reactnativeescposprinter/EscPosPrinterDiscoveryModule.java b/android/src/main/java/com/reactnativeescposprinter/EscPosPrinterDiscoveryModule.java index 9ffb078..f2b1616 100644 --- a/android/src/main/java/com/reactnativeescposprinter/EscPosPrinterDiscoveryModule.java +++ b/android/src/main/java/com/reactnativeescposprinter/EscPosPrinterDiscoveryModule.java @@ -45,7 +45,6 @@ public class EscPosPrinterDiscoveryModule extends ReactContextBaseJavaModule implements ActivityEventListener { private Context mContext; - private WritableArray mPrinterList = null; private final ReactApplicationContext reactContext; public static final String NAME = "EscPosPrinterDiscovery"; @@ -182,7 +181,6 @@ private void sendEvent(ReactApplicationContext reactContext, String eventName, @ @ReactMethod private void startDiscovery(final ReadableMap paramsMap, Promise promise) { FilterOption mFilterOption = getFilterOptionsFromParams(paramsMap); - mPrinterList = Arguments.createArray(); try { Discovery.start(mContext, mFilterOption, mDiscoveryListener); @@ -246,6 +244,7 @@ public void onDiscovery(final DeviceInfo deviceInfo) { UiThreadUtil.runOnUiThread(new Runnable() { @Override public synchronized void run() { + WritableArray mPrinterList = Arguments.createArray(); WritableMap printerData = Arguments.createMap();