Skip to content

Commit a05c3f6

Browse files
committed
add null check
1 parent 6241af9 commit a05c3f6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

android/src/main/java/com/ammarahmed/mmkv/RNMMKVModule.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,12 @@ public void writeToJSON(MMKV kvv) {
134134
Bundle bundle = kvv.decodeParcelable(string, Bundle.class);
135135
if (bundle != null) {
136136
WritableMap map = Arguments.fromBundle(bundle);
137-
List<Object> subChild = Arguments.toList(map.getArray(string));
138-
String obj = gson.toJson(subChild);
139-
kvv.putString(string, obj);
137+
if (map.getArray(string) != null) {
138+
List<Object> subChild = Arguments.toList(map.getArray(string));
139+
String obj = gson.toJson(subChild);
140+
kvv.putString(string, obj);
141+
}
142+
140143
}
141144

142145
}

0 commit comments

Comments
 (0)