From 3c5735e03ec719b073775b611fe50ea8c91a5b16 Mon Sep 17 00:00:00 2001 From: Evan Harris Date: Wed, 7 Aug 2019 04:14:18 -0500 Subject: [PATCH] Fix null exception when creating a new podcast channel Until the podcast channel has been updated to provide it with a title, there is no point to doing any further processing since the directory where episodes are stored is derived from the title. While this change is unrelated to #176, it fixes the traceback shown in that issue. --- .../java/org/airsonic/player/service/PodcastService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/PodcastService.java b/airsonic-main/src/main/java/org/airsonic/player/service/PodcastService.java index eae225ce..ba9c21ed 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/PodcastService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/PodcastService.java @@ -177,7 +177,8 @@ public class PodcastService { */ public PodcastChannel getChannel(int channelId) { PodcastChannel channel = podcastDao.getChannel(channelId); - addMediaFileIdToChannels(Arrays.asList(channel)); + if (channel.getTitle() != null) + addMediaFileIdToChannels(Arrays.asList(channel)); return channel; } @@ -272,6 +273,10 @@ public class PodcastService { private List addMediaFileIdToChannels(List channels) { for (PodcastChannel channel : channels) { try { + if (channel.getTitle() == null) { + LOG.warn("Podcast channel id {} has null title", channel.getId()); + continue; + } File dir = getChannelDirectory(channel); MediaFile mediaFile = mediaFileService.getMediaFile(dir); if (mediaFile != null) {