Skip to content

Commit

Permalink
Merge pull request #263 from guusdk/feed-error
Browse files Browse the repository at this point in the history
Some safety checks
  • Loading branch information
akrherz authored Sep 18, 2024
2 parents 93f54c7 + ed8d86b commit 748d0b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/main/java/org/jivesoftware/site/DiscourseAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,14 @@ public DownloadStatsRunnable(Map<Integer, Long> counts) {

public void run() {
final Map<Integer, Long> results = new HashMap<>();
results.put(3, doSimpleQuery(3, 7));
results.put(4, doSimpleQuery(4, 7));
final Long a = doSimpleQuery(3, 7);
if (a != null) {
results.put(3, a);
}
final Long b = doSimpleQuery(4, 7);
if (b != null) {
results.put(4, b);
}

// Replace all values in the object used by the website in one go.
counts.clear();
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/jivesoftware/site/FeedManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ public List<SummaryFeedItem> getSummaryItems( String baseUrl, String feedUrl, in
final List<SyndEntry> entries = getBlogFeedEntries( baseUrl, feedUrl );
for ( int i=0; i < entries.size() && i < max; i++ )
{
result.add( new SummaryFeedItem( getJSON( entries.get( i ).getLink() ) ) );
final JSONObject entry = getJSON(entries.get(i).getLink());
if (entry != null) {
result.add(new SummaryFeedItem(entry));
}
}

return result;
Expand Down

0 comments on commit 748d0b5

Please sign in to comment.