Skip to content

Commit eee1262

Browse files
committed
Fix Android No Tags Null Pointer Exception
• In cases where a user had no tags and the app called getTags(), the serializer wrapper would attempt to iterate through keys on a null object causing a null pointer exception • Fixed issue by adding an early return in the serializer
1 parent 30045d0 commit eee1262

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

android/src/main/java/com/onesignal/flutter/OneSignalSerializer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ static private HashMap<String, Object> convertAndroidBackgroundImageLayoutToMap(
199199
static public HashMap<String, Object> convertJSONObjectToHashMap(JSONObject object) throws JSONException {
200200
HashMap<String, Object> hash = new HashMap<>();
201201

202+
if (object == null)
203+
return hash;
204+
202205
Iterator<String> keys = object.keys();
203206

204207
while (keys.hasNext()) {

0 commit comments

Comments
 (0)