some fixes

This commit is contained in:
Thomas 2020-07-04 17:44:22 +02:00
parent e2b653ca70
commit 6d3a820aff
2 changed files with 15 additions and 3 deletions

View File

@ -1669,7 +1669,7 @@ public class API {
notification.setAccount(parseAccountResponse(resobj.getJSONObject("account"))); notification.setAccount(parseAccountResponse(resobj.getJSONObject("account")));
if (resobj.has("status")) { if (resobj.has("status")) {
try { try {
notification.setStatus(parseStatuses(context, resobj.getJSONObject("status"))); notification.setStatus(parseStatuses(context, resobj.getJSONObject("status"), false));
} catch (Exception ignored) { } catch (Exception ignored) {
} }
} }

View File

@ -212,14 +212,24 @@ public class GNUAPI {
return statuses; return statuses;
} }
/** /**
* Parse json response for unique status * Parse json response for unique status
* *
* @param resobj JSONObject * @param resobj JSONObject
* @return Status * @return Status
*/ */
@SuppressWarnings("InfiniteRecursion")
private static Status parseStatuses(Context context, JSONObject resobj) { private static Status parseStatuses(Context context, JSONObject resobj) {
return parseStatuses(context, resobj, true);
}
/**
* Parse json response for unique status
*
* @param resobj JSONObject
* @return Status
*/
private static Status parseStatuses(Context context, JSONObject resobj, boolean recursive) {
Status status = new Status(); Status status = new Status();
try { try {
status.setId(resobj.get("id").toString()); status.setId(resobj.get("id").toString());
@ -337,7 +347,9 @@ public class GNUAPI {
status.setMuted(false); status.setMuted(false);
status.setPinned(false); status.setPinned(false);
try { try {
status.setReblog(parseStatuses(context, resobj.getJSONObject("retweeted_status"))); if (recursive) {
status.setReblog(parseStatuses(context, resobj.getJSONObject("retweeted_status"), false));
}
} catch (Exception ignored) { } catch (Exception ignored) {
status.setReblog(null); status.setReblog(null);
} }