mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 20:27:23 +00:00
playlist: check for NULL on caller site
Letting some playlist functions randomly accept NULL, while others do not isn't such a good idea.
This commit is contained in:
parent
7ce464bef9
commit
38874b2f2e
@ -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 (!pl || base_path.len == 0 || bstrcmp0(base_path, ".") == 0)
|
||||
if (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))) {
|
||||
|
@ -648,7 +648,8 @@ struct playlist *playlist_parse_file(const char *file, struct MPOpts *opts)
|
||||
struct playlist *ret = do_parse(stream, true);
|
||||
free_stream(stream);
|
||||
|
||||
playlist_add_base_path(ret, mp_dirname(file));
|
||||
if (ret)
|
||||
playlist_add_base_path(ret, mp_dirname(file));
|
||||
|
||||
return ret;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user