From 369c88f7be53bd0ad04fa8b87ef67ac6a2ee0567 Mon Sep 17 00:00:00 2001 From: Yimura <24669514+Yimura@users.noreply.github.com> Date: Thu, 9 Jan 2025 13:52:15 +0000 Subject: [PATCH] fix: crash on invoke virtual method `onBatchComplete` on a null object reference Fixes #3397 --- .../reactnativeuilib/keyboardinput/utils/RuntimeUtils.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.java b/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.java index 95c5e8ea47..cddcab08cc 100644 --- a/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.java +++ b/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.java @@ -9,7 +9,10 @@ public class RuntimeUtils { private static final Runnable sUIUpdateClosure = new Runnable() { @Override public void run() { - ReactContextHolder.getContext().getNativeModule(UIManagerModule.class).onBatchComplete(); + var nativeModule = ReactContextHolder.getContext().getNativeModule(UIManagerModule.class); + if (nativeModule != null) { + nativeModule.onBatchComplete(); + } } };