summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2009-11-28 12:24:44 +0100
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2009-11-28 12:24:44 +0100
commite51da0e0fb8c55cb874d87dafc7eec93bee6beb3 (patch)
tree17b3ee3448900c0238c3946cf8c1108a79c4b23c /src/main.c
parent7dff801f34a76dd7950fc1751ce5ee2978e9b32d (diff)
downloadpianobar-windows-e51da0e0fb8c55cb874d87dafc7eec93bee6beb3.tar.gz
pianobar-windows-e51da0e0fb8c55cb874d87dafc7eec93bee6beb3.tar.bz2
pianobar-windows-e51da0e0fb8c55cb874d87dafc7eec93bee6beb3.zip
Fix another NULL pointer dereference
Diffstat (limited to 'src/main.c')
-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 */
}