Skip to content

Commit fda7414

Browse files
authored
Merge pull request #20440 from wordpress-mobile/fix/20439-nosetting-response
Prevents crash on unexpected JP rest response
2 parents f6a8606 + 650fe60 commit fda7414

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

WordPress/src/main/java/org/wordpress/android/ui/prefs/WPComSiteSettings.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,10 @@ private JSONObject serializeWpComParamsToJSONObject() throws JSONException {
908908
private void deserializeJetpackRestResponse(SiteModel site, JSONObject response) {
909909
if (site == null || response == null) return;
910910
JSONObject settingsObject = response.optJSONObject("settings");
911+
if (settingsObject == null) {
912+
AppLog.e(AppLog.T.API, "Error: response doesn't contain settings object");
913+
return;
914+
}
911915
mRemoteJpSettings.emailNotifications = settingsObject.optBoolean(JP_MONITOR_EMAIL_NOTES_KEY, false);
912916
mRemoteJpSettings.wpNotifications = settingsObject.optBoolean(JP_MONITOR_WP_NOTES_KEY, false);
913917
}

0 commit comments

Comments
 (0)