From 8a9f04f7fe501af4fb003bf9e46a824b9f796d32 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 19 Feb 2016 18:23:50 +0100 Subject: [PATCH] tag/Id3: catch exceptions --- src/tag/TagId3.cxx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/tag/TagId3.cxx b/src/tag/TagId3.cxx index e46e887bc..1c0355466 100644 --- a/src/tag/TagId3.cxx +++ b/src/tag/TagId3.cxx @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -507,12 +508,19 @@ bool tag_id3_scan(Path path_fs, const struct tag_handler *handler, void *handler_ctx) { - Error error; - struct id3_tag *tag = tag_id3_load(path_fs, error); - if (tag == nullptr) { - if (error.IsDefined()) - LogError(error); + struct id3_tag *tag; + try { + Error error; + tag = tag_id3_load(path_fs, error); + if (tag == nullptr) { + if (error.IsDefined()) + LogError(error); + + return false; + } + } catch (const std::runtime_error &e) { + LogError(e); return false; }