1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-21 02:41:13 +00:00

mpvcore/playlist.c: Avoid NULL reference in playlist_add_base_path()

Before this patch, those will cause a crash:

  mpv -playlist /dev/null
  mpv -playlist <(bla) # if the result of bla is empty

Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com>
Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
This commit is contained in:
Mohammad Alsaleh 2013-10-11 04:24:50 +03:00 committed by Stefano Pigozzi
parent 177c89d948
commit 65a3977282

View File

@ -178,7 +178,7 @@ struct playlist_entry *playlist_get_next(struct playlist *pl, int direction)
void playlist_add_base_path(struct playlist *pl, bstr base_path)
{
if (base_path.len == 0 || bstrcmp0(base_path, ".") == 0)
if (!pl || base_path.len == 0 || bstrcmp0(base_path, ".") == 0)
return;
for (struct playlist_entry *e = pl->first; e; e = e->next) {
if (!mp_is_url(bstr0(e->filename))) {