diff options
author | John Regan <john@jrjrtech.com> | 2020-02-18 15:06:52 -0500 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-02-25 20:12:08 +0100 |
commit | 976372ff6334db52e2e2beef24794cd4549de592 (patch) | |
tree | 38c034bb90d99a93a4cd80a5b8f335e3760d19e6 /src | |
parent | 9abb686eebfa0a512a45586d3ff3d46b4da8ecff (diff) |
gme: check for empty metadata strings instead of nullptr
Using libgme 0.6.2 on macOS, it appears that gme_info_t strings can be
empty, which creates weird track titles: (001/050)
This adds an additional check for an empty string.
Diffstat (limited to 'src')
-rw-r--r-- | src/decoder/plugins/GmeDecoderPlugin.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/decoder/plugins/GmeDecoderPlugin.cxx b/src/decoder/plugins/GmeDecoderPlugin.cxx index 64f0a1ad4..fcea526af 100644 --- a/src/decoder/plugins/GmeDecoderPlugin.cxx +++ b/src/decoder/plugins/GmeDecoderPlugin.cxx @@ -28,6 +28,7 @@ #include "fs/AllocatedPath.hxx" #include "fs/FileSystem.hxx" #include "util/ScopeExit.hxx" +#include "util/StringCompare.hxx" #include "util/StringFormat.hxx" #include "util/UriUtil.hxx" #include "util/Domain.hxx" @@ -222,7 +223,7 @@ ScanGmeInfo(const gme_info_t &info, unsigned song_num, int track_count, if (track_count > 1) handler.OnTag(TAG_TRACK, StringFormat<16>("%u", song_num + 1)); - if (info.song != nullptr) { + if (!StringIsEmpty(info.song)) { if (track_count > 1) { /* start numbering subtunes from 1 */ const auto tag_title = @@ -234,16 +235,16 @@ ScanGmeInfo(const gme_info_t &info, unsigned song_num, int track_count, handler.OnTag(TAG_TITLE, info.song); } - if (info.author != nullptr) + if (!StringIsEmpty(info.author)) handler.OnTag(TAG_ARTIST, info.author); - if (info.game != nullptr) + if (!StringIsEmpty(info.game)) handler.OnTag(TAG_ALBUM, info.game); - if (info.comment != nullptr) + if (!StringIsEmpty(info.comment)) handler.OnTag(TAG_COMMENT, info.comment); - if (info.copyright != nullptr) + if (!StringIsEmpty(info.copyright)) handler.OnTag(TAG_DATE, info.copyright); } |