Commit 4f393553 authored by Max Kellermann's avatar Max Kellermann

playlist/Song: catch SongLoader exceptions

Fixes aborted "load" commands due to SongLoader failure.
parent 91afc7b2
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include "util/Error.hxx" #include "util/Error.hxx"
#include "DetachedSong.hxx" #include "DetachedSong.hxx"
#include <stdexcept>
#include <string.h> #include <string.h>
static void static void
...@@ -44,7 +46,14 @@ merge_song_metadata(DetachedSong &add, const DetachedSong &base) ...@@ -44,7 +46,14 @@ merge_song_metadata(DetachedSong &add, const DetachedSong &base)
static bool static bool
playlist_check_load_song(DetachedSong &song, const SongLoader &loader) playlist_check_load_song(DetachedSong &song, const SongLoader &loader)
{ {
DetachedSong *tmp = loader.LoadSong(song.GetURI(), IgnoreError()); DetachedSong *tmp;
try {
tmp = loader.LoadSong(song.GetURI(), IgnoreError());
} catch (const std::runtime_error &) {
return false;
}
if (tmp == nullptr) if (tmp == nullptr)
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment