summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c53
1 files changed, 29 insertions, 24 deletions
diff --git a/src/main.c b/src/main.c
index 08eac48..190a148 100644
--- a/src/main.c
+++ b/src/main.c
@@ -231,30 +231,35 @@ int main (int argc, char **argv) {
BarUiPrintSong (curSong, curStation->isQuickMix ?
PianoFindStationById (ph.stations,
curSong->stationId) : NULL);
- /* setup artist and song name for scrobbling (curSong
- * may be NULL later) */
- WardrobeSongInit (&scrobbleSong);
- scrobbleSong.artist = strdup (curSong->artist);
- scrobbleSong.title = strdup (curSong->title);
- scrobbleSong.album = strdup (curSong->album);
- scrobbleSong.started = time (NULL);
-
- /* setup player */
- memset (&player, 0, sizeof (player));
-
- WaitressInit (&player.waith);
- WaitressSetUrl (&player.waith, curSong->audioUrl);
-
- player.gain = curSong->fileGain;
- player.audioFormat = curSong->audioFormat;
-
- /* throw event */
- BarUiStartEventCmd (&settings, "songstart", curStation,
- curSong, PIANO_RET_OK);
-
- /* start player */
- pthread_create (&playerThread, NULL, BarPlayerThread,
- &player);
+
+ if (curSong->audioUrl == NULL) {
+ BarUiMsg (MSG_ERR, "Invalid song url\n");
+ } else {
+ /* setup artist and song name for scrobbling (curSong
+ * may be NULL later) */
+ WardrobeSongInit (&scrobbleSong);
+ scrobbleSong.artist = strdup (curSong->artist);
+ scrobbleSong.title = strdup (curSong->title);
+ scrobbleSong.album = strdup (curSong->album);
+ scrobbleSong.started = time (NULL);
+
+ /* setup player */
+ memset (&player, 0, sizeof (player));
+
+ WaitressInit (&player.waith);
+ WaitressSetUrl (&player.waith, curSong->audioUrl);
+
+ player.gain = curSong->fileGain;
+ player.audioFormat = curSong->audioFormat;
+
+ /* throw event */
+ BarUiStartEventCmd (&settings, "songstart", curStation,
+ curSong, PIANO_RET_OK);
+
+ /* start player */
+ pthread_create (&playerThread, NULL, BarPlayerThread,
+ &player);
+ }
}
} /* end if curStation != NULL */
}