summaryrefslogtreecommitdiff
path: root/src/PlaylistSave.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2016-04-13 11:51:01 +0200
committerMax Kellermann <max@duempel.org>2016-04-21 10:15:40 +0200
commitb9f535cd4935edea8c3402e39d864231efbb2580 (patch)
tree8d3598bbfe39a9c235689287069dc76bda7dc5bb /src/PlaylistSave.cxx
parente2281441598bc8205987857d388b7640aa7ea4d0 (diff)
lib/icu/Win32: throw exception on error
Diffstat (limited to 'src/PlaylistSave.cxx')
-rw-r--r--src/PlaylistSave.cxx30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/PlaylistSave.cxx b/src/PlaylistSave.cxx
index 23e6f3f49..c8010b3d7 100644
--- a/src/PlaylistSave.cxx
+++ b/src/PlaylistSave.cxx
@@ -33,6 +33,8 @@
#include "fs/io/BufferedOutputStream.hxx"
#include "util/UriUtil.hxx"
+#include <stdexcept>
+
void
playlist_print_song(BufferedOutputStream &os, const DetachedSong &song)
{
@@ -40,25 +42,31 @@ playlist_print_song(BufferedOutputStream &os, const DetachedSong &song)
? song.GetRealURI()
: song.GetURI();
- const auto uri_fs = AllocatedPath::FromUTF8(uri_utf8);
- if (!uri_fs.IsNull())
- os.Format("%s\n", NarrowPath(uri_fs).c_str());
+ try {
+ const auto uri_fs = AllocatedPath::FromUTF8(uri_utf8);
+ if (!uri_fs.IsNull())
+ os.Format("%s\n", NarrowPath(uri_fs).c_str());
+ } catch (const std::runtime_error &) {
+ }
}
void
playlist_print_uri(BufferedOutputStream &os, const char *uri)
{
- auto path =
+ try {
+ auto path =
#ifdef ENABLE_DATABASE
- playlist_saveAbsolutePaths && !uri_has_scheme(uri) &&
- !PathTraitsUTF8::IsAbsolute(uri)
- ? map_uri_fs(uri)
- :
+ playlist_saveAbsolutePaths && !uri_has_scheme(uri) &&
+ !PathTraitsUTF8::IsAbsolute(uri)
+ ? map_uri_fs(uri)
+ :
#endif
- AllocatedPath::FromUTF8(uri);
+ AllocatedPath::FromUTF8(uri);
- if (!path.IsNull())
- os.Format("%s\n", NarrowPath(path).c_str());
+ if (!path.IsNull())
+ os.Format("%s\n", NarrowPath(path).c_str());
+ } catch (const std::runtime_error &) {
+ }
}
void