From a0f958894e33affff3ae1ba5b1aa7d20f5c93d60 Mon Sep 17 00:00:00 2001 From: Ryan Goulden Date: Mon, 16 Sep 2024 21:49:25 -0700 Subject: [PATCH] fix plt_load_from_buffer plt_load_from_buffer calls _plt_load_from_file with fname=NULL, which basically just unconditionally crashes. Anyway, drag-and-drop from the sidebar into a playlist was broken on macOS beacause of this. Seems to be fine with this fix. --- src/playlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/playlist.c b/src/playlist.c index 8ffa52da09..e54bab463a 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -2445,8 +2445,8 @@ _plt_load_from_file (playlist_t *plt, const char *fname, ddb_file_handle_t *fp, goto load_fail; } - char *slash = strrchr (fname, '/'); - if (slash && fname) { + char *slash = fname ? strrchr (fname, '/') : NULL; + if (slash) { dname = strndup (fname, slash - fname); }