Skip to content

Commit fb10779

Browse files
author
werwolf2303
committed
Improve home tab parser
Added catch to HomeTab.fromJSON for unsupported/unknown sections
1 parent 8136deb commit fb10779

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/com/spotifyxp/api/UnofficialSpotifyAPI.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,11 @@ public ArrayList<HomeTabSection> getSections() {
287287
public static HomeTab fromJSON(JSONObject json) {
288288
ArrayList<HomeTabSection> sections = new ArrayList<>();
289289
for(Object sectionObject : json.getJSONObject("sectionContainer").getJSONObject("sections").getJSONArray("items")) {
290-
sections.add(HomeTabSection.fromJSON(new JSONObject(sectionObject.toString())));
290+
try {
291+
sections.add(HomeTabSection.fromJSON(new JSONObject(sectionObject.toString())));
292+
}catch (JSONException e) {
293+
ConsoleLogging.warning("[HomeTab] Got section item with unknown/unsupported data");
294+
}
291295
}
292296
return new HomeTab(
293297
json.getJSONObject("greeting").getString("text"),

0 commit comments

Comments
 (0)