From 233b8d0129a43c8dcd61793dd3df69849a7becef Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 19 Mar 2016 00:14:36 +0100 Subject: [PATCH] sticker/Song: catch Database::GetSong() exceptions --- src/sticker/SongSticker.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/sticker/SongSticker.cxx b/src/sticker/SongSticker.cxx index 0ccedc249..121494af9 100644 --- a/src/sticker/SongSticker.cxx +++ b/src/sticker/SongSticker.cxx @@ -92,10 +92,13 @@ sticker_song_find_cb(const char *uri, const char *value, void *user_data) return; const Database *db = data->db; - const LightSong *song = db->GetSong(uri, IgnoreError()); - if (song != nullptr) { - data->func(*song, value, data->user_data); - db->ReturnSong(song); + try { + const LightSong *song = db->GetSong(uri, IgnoreError()); + if (song != nullptr) { + data->func(*song, value, data->user_data); + db->ReturnSong(song); + } + } catch (const std::runtime_error &e) { } }