diff --git a/src/main/java/hyphenated/djbot/DjService.java b/src/main/java/hyphenated/djbot/DjService.java index cbe6bd5..1c92277 100644 --- a/src/main/java/hyphenated/djbot/DjService.java +++ b/src/main/java/hyphenated/djbot/DjService.java @@ -590,10 +590,16 @@ private void updatePlayedSongsFile() throws IOException { //go write to the filesystem so the user can overlay this text file on their stream if they want private void updateNowPlayingFile(SongEntry currentSong) { - String nowPlaying = conf.getNowPlayingPattern(); - nowPlaying = nowPlaying.replace("%title%", currentSong.getTitle()); - nowPlaying = nowPlaying.replace("%user%", currentSong.getUser()); - nowPlaying = nowPlaying.replace("%length%", currentSong.buildDurationStr()); + String nowPlaying; + if(currentSong != null) { + nowPlaying = conf.getNowPlayingPattern(); + nowPlaying = nowPlaying.replace("%title%", currentSong.getTitle()); + nowPlaying = nowPlaying.replace("%user%", currentSong.getUser()); + nowPlaying = nowPlaying.replace("%length%", currentSong.buildDurationStr()); + } else { + nowPlaying = ""; + } + try { FileUtils.writeStringToFile(new File(nowPlayingFilePath), nowPlaying, false); } catch (IOException e) {