Avoid a NPE if the public URL is not set.

--HG--
extra : rebase_source : 9b98f856d10dff6cb19bbaf90fb7eb22336aea7f
This commit is contained in:
Risto Kankkunen
2013-05-20 22:10:44 +03:00
parent 9651e9cf4a
commit 9fc5cee6fe

View File

@@ -41,7 +41,11 @@ public class FeedSubscriptionService {
public Feed subscribe(User user, String url, String title,
FeedCategory category) {
if (url.startsWith(applicationSettingsService.get().getPublicUrl())) {
final String pubUrl = applicationSettingsService.get().getPublicUrl();
if (pubUrl == null) {
throw new RuntimeException("Public URL of this CommaFeed is unset");
}
if (url.startsWith(pubUrl)) {
throw new RuntimeException(
"Could not subscribe to a feed from this CommaFeed instance");
}