Skip to content

Commit 02c6f40

Browse files
committed
Fixed: JSON change caused missing field
From "coverUrl" -> "cover.url" Really need to redo the Client structure
1 parent 56a9491 commit 02c6f40

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/src/main/java/cn/settile/fanboxviewer/Network/RESTfulClient/FanboxUserParser.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,9 @@ private static CardItem getCardItem(JSONObject json, Context c) throws JSONExcep
411411
SimpleDateFormat sdf = new SimpleDateFormat(c.getString(R.string.date_formatting));
412412
date = sdf.format(df.parse(date));
413413

414-
String headerUrl = json.getString("coverImageUrl");
415-
if(headerUrl == null || headerUrl.equals("null")){
414+
JSONObject cover = json.optJSONObject("cover");
415+
String headerUrl = Objects.isNull(cover) ? "null" : cover.optString("url", "null");
416+
if(headerUrl.equals("null")){
416417
JSONObject body = json.optJSONObject("body");
417418
if(body != null){
418419
JSONArray image = body.optJSONArray("images");

0 commit comments

Comments
 (0)