1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-12-04 14:46:31 -05:00

If there are no playlist entries, dereferencing pl->list causes a segfault.

Fix this by checking pl->num early.


git-svn-id: https://svn.xiph.org/trunk/ezstream@13800 0101bb08-14d6-0310-b084-bc0e0c8e3800
This commit is contained in:
moritz 2007-09-14 06:59:28 +00:00
parent 6955c0006f
commit b3f845a60d

View File

@ -287,6 +287,9 @@ playlist_get_next(playlist_t *pl)
if (pl->program)
return (playlist_run_program(pl));
if (pl->num == 0)
return (NULL);
return ((const char *)pl->list[pl->index++]);
}
@ -299,7 +302,7 @@ playlist_peek_next(playlist_t *pl)
exit(1);
}
if (pl->program)
if (pl->program || pl->num == 0)
return (NULL);
return ((const char *)pl->list[pl->index]);
@ -314,7 +317,7 @@ playlist_skip_next(playlist_t *pl)
exit(1);
}
if (pl->program)
if (pl->program || pl->num == 0)
return;
if (pl->list[pl->index] != NULL)