From 93357dd65189fbc7edb0ca1b166120872aa4ad6c Mon Sep 17 00:00:00 2001 From: Soheb Date: Tue, 31 Jul 2018 10:51:00 +0100 Subject: [PATCH] Fix NoSuchKeyException There is a case where trying to get "strings" from the map fails and React Native crashes on Android with a NoSuchKeyException. This code should check if the "strings" key exists and if not return a new HashMap instead. --- .../br/com/classapp/RNSensitiveInfo/RNSensitiveInfoModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/java/br/com/classapp/RNSensitiveInfo/RNSensitiveInfoModule.java b/android/src/main/java/br/com/classapp/RNSensitiveInfo/RNSensitiveInfoModule.java index 7f73b086..a0c6f0c7 100644 --- a/android/src/main/java/br/com/classapp/RNSensitiveInfo/RNSensitiveInfoModule.java +++ b/android/src/main/java/br/com/classapp/RNSensitiveInfo/RNSensitiveInfoModule.java @@ -125,7 +125,7 @@ public void getItem(String key, ReadableMap options, Promise pm) { if (value != null && options.hasKey("touchID") && options.getBoolean("touchID")) { boolean showModal = options.hasKey("showModal") && options.getBoolean("showModal"); - HashMap strings = options.getMap("strings").toHashMap(); + HashMap strings = options.hasKey("strings") ? options.getMap("strings").toHashMap() : new HashMap(); decryptWithAes(value, showModal, strings, pm, null); } else {