prevent NPE

This commit is contained in:
Athou
2013-03-31 14:05:17 +02:00
parent 6d971fa3f3
commit 38a85fcf6f
2 changed files with 14 additions and 11 deletions

View File

@@ -15,7 +15,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jpa.datasource.name>java:openejb/Resource/My DataSource</jpa.datasource.name>
<jpa.show_sql>true</jpa.show_sql>
<jpa.show_sql>false</jpa.show_sql>
</properties>
<build>

View File

@@ -54,9 +54,11 @@ public class EntriesREST extends AbstractREST {
if (type == Type.feed) {
FeedSubscription subscription = feedSubscriptionService.findById(
getUser(), Long.valueOf(id));
entries.setName(subscription.getTitle());
entries.getEntries().addAll(
buildEntries(subscription, offset, limit, unreadOnly));
if (subscription != null) {
entries.setName(subscription.getTitle());
entries.getEntries().addAll(
buildEntries(subscription, offset, limit, unreadOnly));
}
} else {
@@ -76,13 +78,14 @@ public class EntriesREST extends AbstractREST {
} else {
FeedCategory feedCategory = feedCategoryService.findById(
getUser(), Long.valueOf(id));
List<FeedCategory> childrenCategories = feedCategoryService
.findAllChildrenCategories(getUser(), feedCategory);
entries.getEntries().addAll(
buildEntries(childrenCategories, subMapping, offset,
limit, unreadOnly));
entries.setName(feedCategory.getName());
if (feedCategory != null) {
List<FeedCategory> childrenCategories = feedCategoryService
.findAllChildrenCategories(getUser(), feedCategory);
entries.getEntries().addAll(
buildEntries(childrenCategories, subMapping,
offset, limit, unreadOnly));
entries.setName(feedCategory.getName());
}
}
}