aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:11 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:11 +0200
commitdf251a9960c2ced5f3ac06b57de3b789c189df03 (patch)
tree844825a529017e0cd5950bd385faf1363b27f385
parente99333167e152dcdd3b40ae812f920eb5023543a (diff)
downloadmpd-df251a9960c2ced5f3ac06b57de3b789c189df03.tar.gz
mpd-df251a9960c2ced5f3ac06b57de3b789c189df03.tar.xz
mpd-df251a9960c2ced5f3ac06b57de3b789c189df03.zip
assert song->url != NULL
-rw-r--r--src/player.c3
-rw-r--r--src/player_thread.c4
-rw-r--r--src/song.c3
3 files changed, 10 insertions, 0 deletions
diff --git a/src/player.c b/src/player.c
index c2e84c1bd..9ca4c6b95 100644
--- a/src/player.c
+++ b/src/player.c
@@ -39,6 +39,9 @@ int playerWait(int fd)
static void set_current_song(Song *song)
{
+ assert(song != NULL);
+ assert(song->url != NULL);
+
pc.fileTime = song->tag ? song->tag->time : 0;
pc.next_song = song;
}
diff --git a/src/player_thread.c b/src/player_thread.c
index fa3bbccf7..62badab96 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -69,6 +69,7 @@ static int waitOnDecode(int *decodeWaitedOn)
}
if (dc.error != DECODE_ERROR_NOERROR) {
+ assert(dc.next_song == NULL || dc.next_song->url != NULL);
pc.errored_song = dc.next_song;
pc.error = PLAYER_ERROR_FILE;
return -1;
@@ -148,6 +149,7 @@ static void processDecodeInput(int *pause_r, unsigned int *bbp_r,
pc.state = PLAYER_STATE_PLAY;
} else {
char tmp[MPD_PATH_MAX];
+ assert(dc.next_song == NULL || dc.next_song->url != NULL);
pc.errored_song = dc.next_song;
pc.error = PLAYER_ERROR_AUDIO;
ERROR("problems opening audio device "
@@ -246,6 +248,7 @@ static void decodeParent(void)
decodeWaitedOn = 0;
if(openAudioDevice(&(ob.audioFormat))<0) {
char tmp[MPD_PATH_MAX];
+ assert(dc.next_song == NULL || dc.next_song->url != NULL);
pc.errored_song = dc.next_song;
pc.error = PLAYER_ERROR_AUDIO;
ERROR("problems opening audio device "
@@ -266,6 +269,7 @@ static void decodeParent(void)
}
else if(dc.state!=DECODE_STATE_START) {
/* the decoder failed */
+ assert(dc.next_song == NULL || dc.next_song->url != NULL);
pc.errored_song = dc.next_song;
pc.error = PLAYER_ERROR_FILE;
break;
diff --git a/src/song.c b/src/song.c
index 1149da8bb..718c358e8 100644
--- a/src/song.c
+++ b/src/song.c
@@ -316,6 +316,9 @@ char *get_song_url(char *path_max_tmp, Song *song)
{
if (!song)
return NULL;
+
+ assert(song->url != NULL);
+
if (!song->parentDir || !song->parentDir->path)
strcpy(path_max_tmp, song->url);
else