Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commit 01fcf62

Browse files
Merge pull request #128 from launchdarkly/lchan/sc-167623/update-is-initialized
The null check logic for isInitialized
2 parents b53e99b + b9b7c26 commit 01fcf62

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

android/src/main/java/com/launchdarkly/reactnative/LaunchdarklyReactNativeClientModule.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,13 @@ public void setOnline(Promise promise) {
494494
@ReactMethod
495495
public void isInitialized(String environment, Promise promise) {
496496
try {
497-
boolean result = LDClient.getForMobileKey(environment).isInitialized();
498-
promise.resolve(result);
497+
LDClient instance = LDClient.getForMobileKey(environment);
498+
if (instance == null) {
499+
promise.resolve(false);
500+
} else {
501+
boolean result = instance.isInitialized();
502+
promise.resolve(result);
503+
}
499504
} catch (Exception e) {
500505
promise.reject(ERROR_UNKNOWN, e);
501506
}

0 commit comments

Comments
 (0)