Skip to content

Commit

Permalink
additional null check
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyphen-ated committed Jul 5, 2015
1 parent 195aa28 commit 36f2626
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/hyphenated/djbot/DjService.java
Original file line number Diff line number Diff line change
Expand Up @@ -593,10 +593,15 @@ private void updateNowPlayingFile(SongEntry currentSong) {
String nowPlaying;
if(currentSong != null) {
nowPlaying = conf.getNowPlayingPattern();
if(StringUtils.isBlank(nowPlaying)) {
//if there's no pattern to write, just don't do anything
return;
}
nowPlaying = nowPlaying.replace("%title%", currentSong.getTitle());
nowPlaying = nowPlaying.replace("%user%", currentSong.getUser());
nowPlaying = nowPlaying.replace("%length%", currentSong.buildDurationStr());
} else {
//empty out the file if there's no current song
nowPlaying = "";
}

Expand Down

0 comments on commit 36f2626

Please sign in to comment.