Commit e1a4474a authored by Max Kellermann's avatar Max Kellermann

song: don't allow calling song_get_url(NULL)

The runtime check suggests that the author has somehow thought song_get_url(NULL) might be valid. It should not be. Replace it with an assertion.
parent 4ab6b59a
...@@ -37,10 +37,7 @@ static void decodeStart(void) ...@@ -37,10 +37,7 @@ static void decodeStart(void)
char path_max_fs[MPD_PATH_MAX]; char path_max_fs[MPD_PATH_MAX];
char path_max_utf8[MPD_PATH_MAX]; char path_max_utf8[MPD_PATH_MAX];
if (!song_get_url(dc.next_song, path_max_utf8)) { song_get_url(dc.next_song, path_max_utf8);
dc.error = DECODE_ERROR_FILE;
goto stop_no_close;
}
if (!isRemoteUrl(path_max_utf8)) { if (!isRemoteUrl(path_max_utf8)) {
rmp2amp_r(path_max_fs, rmp2amp_r(path_max_fs,
utf8_to_fs_charset(path_max_fs, path_max_utf8)); utf8_to_fs_charset(path_max_fs, path_max_utf8));
......
...@@ -121,9 +121,7 @@ song_file_update(struct song *song) ...@@ -121,9 +121,7 @@ song_file_update(struct song *song)
char * char *
song_get_url(struct song *song, char *path_max_tmp) song_get_url(struct song *song, char *path_max_tmp)
{ {
if (!song) assert(song != NULL);
return NULL;
assert(*song->url); assert(*song->url);
if (!song->parent || !song->parent->path) if (!song->parent || !song->parent->path)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment