summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2016-02-19 18:23:50 +0100
committerMax Kellermann <max@duempel.org>2016-02-19 18:23:54 +0100
commit8a9f04f7fe501af4fb003bf9e46a824b9f796d32 (patch)
tree3311599e30bd4734487b70c3b16baa73580768d2
parent98bd4dfe04cd837e64c12debc103f46b59c1938d (diff)
tag/Id3: catch exceptions
-rw-r--r--src/tag/TagId3.cxx20
1 files changed, 14 insertions, 6 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 <id3tag.h>
#include <string>
+#include <stdexcept>
#include <stdio.h>
#include <stdlib.h>
@@ -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;
}