Skip to content

Commit 17c5156

Browse files
committed
more pr feedback
1 parent f1a5cc3 commit 17c5156

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

android/src/main/java/com/onesignal/rnonesignalandroid/RNUtils.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,25 +310,23 @@ public static List<Object> convertReadableArrayToList(ReadableArray readableArra
310310

311311
private static Object convertValue(ReadableType type, ReadableMap map, String key) {
312312
switch (type) {
313-
case Null: return null;
314313
case Boolean: return map.getBoolean(key);
315314
case Number: return map.getDouble(key);
316315
case String: return map.getString(key);
317316
case Map: return convertReadableMapToMap(map.getMap(key));
318317
case Array: return convertReadableArrayToList(map.getArray(key));
319-
default: throw new IllegalArgumentException("Unknown type for key: " + key);
318+
default: return null;
320319
}
321320
}
322321

323322
private static Object convertValue(ReadableType type, ReadableArray array, int index) {
324323
switch (type) {
325-
case Null: return null;
326324
case Boolean: return array.getBoolean(index);
327325
case Number: return array.getDouble(index);
328326
case String: return array.getString(index);
329327
case Map: return convertReadableMapToMap(array.getMap(index));
330328
case Array: return convertReadableArrayToList(array.getArray(index));
331-
default: throw new IllegalArgumentException("Unknown type for index: " + index);
329+
default: return null;
332330
}
333331
}
334332

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ export namespace OneSignal {
10191019
* Returns true if the value is a JSON-serializable object.
10201020
*/
10211021
function isObjectSerializable(value: unknown): boolean {
1022-
if (!(typeof value === 'object' && value !== null && !Array.isArray(value))) {
1022+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
10231023
return false;
10241024
}
10251025
try {

0 commit comments

Comments
 (0)