From bb2b3eb30657c2482b2b6271b9272d0ac3ec13c8 Mon Sep 17 00:00:00 2001 From: Hampton Maxwell Date: Fri, 22 Jun 2018 19:20:25 -0700 Subject: [PATCH] Handle converting maps that are null or empty --- .../src/main/java/com/brentvatne/react/ReactVideoView.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/android/src/main/java/com/brentvatne/react/ReactVideoView.java b/android/src/main/java/com/brentvatne/react/ReactVideoView.java index 09e5220f..8eabeff1 100644 --- a/android/src/main/java/com/brentvatne/react/ReactVideoView.java +++ b/android/src/main/java/com/brentvatne/react/ReactVideoView.java @@ -641,14 +641,11 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP * @see 'Adapted from https://github.com/artemyarulin/react-native-eval/blob/master/android/src/main/java/com/evaluator/react/ConversionUtil.java' */ public static Map toStringMap(@Nullable ReadableMap readableMap) { + Map result = new HashMap<>(); if (readableMap == null) - return null; + return result; com.facebook.react.bridge.ReadableMapKeySetIterator iterator = readableMap.keySetIterator(); - if (!iterator.hasNextKey()) - return null; - - Map result = new HashMap<>(); while (iterator.hasNextKey()) { String key = iterator.nextKey(); result.put(key, readableMap.getString(key));