From c562bf002073a0085cd149a70098b51e86285728 Mon Sep 17 00:00:00 2001 From: waker Date: Sun, 4 Dec 2011 19:09:35 +0100 Subject: m3u: fixed crash when file from playlist doesn't exist --- plugins/m3u/m3u.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'plugins') diff --git a/plugins/m3u/m3u.c b/plugins/m3u/m3u.c index 34f00ca4..f3949e17 100644 --- a/plugins/m3u/m3u.c +++ b/plugins/m3u/m3u.c @@ -129,17 +129,19 @@ load_m3u (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pab if (strrchr (nm, '/')) { trace ("pl_insert_m3u: adding file %s\n", nm); it = deadbeef->plt_insert_file (plt, after, nm, pabort, cb, user_data); - if (length >= 0) { - deadbeef->plt_set_item_duration (plt, it, length); - } - if (title[0]) { - deadbeef->pl_replace_meta (it, "title", title); - } - else if (artist[0]) { - deadbeef->pl_replace_meta (it, "title", " "); - } - if (artist[0]) { - deadbeef->pl_replace_meta (it, "artist", artist); + if (it) { + if (length >= 0) { + deadbeef->plt_set_item_duration (plt, it, length); + } + if (title[0]) { + deadbeef->pl_replace_meta (it, "title", title); + } + else if (artist[0]) { + deadbeef->pl_replace_meta (it, "title", " "); + } + if (artist[0]) { + deadbeef->pl_replace_meta (it, "artist", artist); + } } } else { -- cgit v1.2.3