fix null ptr exception in feed/get/{id} rest call when all entries are read

- map of the unread counts does not contain any element for the feed if
  no entry is unread, leading to a null pointer exception when building
  the response
- problem occurs for example when showing the feed details and all entries
  are read: all fields are blank
This commit is contained in:
MageFroh
2013-07-09 23:00:47 +01:00
parent b2d0d8da26
commit 7ace9c46da

View File

@@ -308,6 +308,9 @@ public class FeedREST extends AbstractResourceREST {
return Response.status(Status.NOT_FOUND).build();
}
Long unreadCount = feedSubscriptionService.getUnreadCount(getUser()).get(id);
if (unreadCount == null) {
unreadCount = new Long(0);
}
return Response.ok(
Subscription.build(sub, applicationSettingsService.get()
.getPublicUrl(), unreadCount)).build();