Prevent Marketplace NPE on last page without topics (#2518)

Fixes #2505

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born 2021-10-12 09:04:42 +02:00 committed by GitHub
parent 875ca0602e
commit fa92c20bb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -177,7 +177,9 @@ public class CommunityMarketplaceAddonService implements AddonService {
try (Reader reader = new InputStreamReader(connection.getInputStream())) {
DiscourseCategoryResponseDTO parsed = gson.fromJson(reader, DiscourseCategoryResponseDTO.class);
pages.add(parsed);
if (parsed.topic_list.topics.length != 0) {
pages.add(parsed);
}
if (parsed.topic_list.more_topics_url != null) {
// Discourse URL for next page is wrong