From 685389bfbdfe3057ea0dbf181cbea0de9b99b139 Mon Sep 17 00:00:00 2001 From: Ben Wheeler Date: Fri, 14 Aug 2020 13:50:36 -0400 Subject: [PATCH] only call setAnalyticsPref with a valid key, value pair --- .../java/org/scratchjr/android/JavaScriptDirectInterface.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/android/ScratchJr/app/src/main/java/org/scratchjr/android/JavaScriptDirectInterface.java b/android/ScratchJr/app/src/main/java/org/scratchjr/android/JavaScriptDirectInterface.java index 1f7541e..f61f1f6 100644 --- a/android/ScratchJr/app/src/main/java/org/scratchjr/android/JavaScriptDirectInterface.java +++ b/android/ScratchJr/app/src/main/java/org/scratchjr/android/JavaScriptDirectInterface.java @@ -642,10 +642,11 @@ public class JavaScriptDirectInterface { JSONArray jsonArray = jsonObject.names(); String key = jsonArray.getString(0); String value = jsonObject.getString(key); + _activity.setAnalyticsPref(key, value); } catch (JSONException e) { Log.e(LOG_TAG, "JSON error: " + e.getMessage(), e); + return; } - _activity.setAnalyticsPref(key, value); } } }