diff --git a/Branch-SDK/src/main/java/io/branch/referral/PrefHelper.java b/Branch-SDK/src/main/java/io/branch/referral/PrefHelper.java index 72de80b3c..bdcf3972e 100644 --- a/Branch-SDK/src/main/java/io/branch/referral/PrefHelper.java +++ b/Branch-SDK/src/main/java/io/branch/referral/PrefHelper.java @@ -704,10 +704,10 @@ public String getAppStoreSource(){ * @param referringUrlQueryParameters */ public void setReferringUrlQueryParameters(JSONObject referringUrlQueryParameters) { - if (referringUrlQueryParameters.length() == 0) { + if (referringUrlQueryParameters == null || referringUrlQueryParameters.length() == 0) { setString(KEY_REFERRING_URL_QUERY_PARAMETERS, NO_STRING_VALUE); } else { - setString(KEY_REFERRING_URL_QUERY_PARAMETERS, String.valueOf(referringUrlQueryParameters)); + setString(KEY_REFERRING_URL_QUERY_PARAMETERS, referringUrlQueryParameters.toString()); } }