From 9f174c56ce52b72c31b9c3da57c0c54a1e8c5ba9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 15 May 2024 21:07:41 +0200 Subject: [PATCH] playlist/Mapper: postpone the stored playlist error Fixes another regression by commit f53cd44c7a557cde5b16928728ceea10d4431c0a - an exception thrown by playlist_open_in_playlist_dir() would skip over playlist_open_in_storage(). --- src/playlist/PlaylistMapper.cxx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/playlist/PlaylistMapper.cxx b/src/playlist/PlaylistMapper.cxx index 29f568747..970f6f0f9 100644 --- a/src/playlist/PlaylistMapper.cxx +++ b/src/playlist/PlaylistMapper.cxx @@ -56,10 +56,18 @@ playlist_mapper_open(const char *uri, #endif Mutex &mutex) { + std::exception_ptr spl_error; + if (spl_valid_name(uri)) { - auto playlist = playlist_open_in_playlist_dir(uri, mutex); - if (playlist != nullptr) - return playlist; + try { + auto playlist = playlist_open_in_playlist_dir(uri, mutex); + if (playlist != nullptr) + return playlist; + } catch (...) { + /* postpone this exception, try playlist in + music_directory first */ + spl_error = std::current_exception(); + } } #ifdef ENABLE_DATABASE @@ -70,5 +78,8 @@ playlist_mapper_open(const char *uri, } #endif + if (spl_error) + std::rethrow_exception(spl_error); + return nullptr; }