From 380aa7d88483c90fa20c957b2c9edd94dd2ac607 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Mon, 7 Dec 2020 21:57:15 +0100 Subject: [PATCH] Only set disc and year in CUE parser when valid --- src/playlistparsers/cueparser.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/playlistparsers/cueparser.cpp b/src/playlistparsers/cueparser.cpp index 1e7dae420..14bd83e44 100644 --- a/src/playlistparsers/cueparser.cpp +++ b/src/playlistparsers/cueparser.cpp @@ -295,8 +295,11 @@ bool CueParser::UpdateSong(const CueEntry &entry, const QString &next_index, Son song->set_albumartist(entry.album_artist); song->set_composer(entry.PrettyComposer()); song->set_genre(entry.genre); - song->set_year(entry.date.toInt()); - song->set_disc(entry.disc.toInt()); + + int year = entry.date.toInt(); + if (year > 0) song->set_year(year); + int disc = entry.disc.toInt(); + if (disc > 0) song->set_disc(disc); return true; @@ -320,9 +323,12 @@ bool CueParser::UpdateLastSong(const CueEntry &entry, Song *song) const { song->set_album(entry.album); song->set_albumartist(entry.album_artist); song->set_genre(entry.genre); - song->set_year(entry.date.toInt()); song->set_composer(entry.PrettyComposer()); - song->set_disc(entry.disc.toInt()); + + int year = entry.date.toInt(); + if (year > 0) song->set_year(year); + int disc = entry.disc.toInt(); + if (disc > 0) song->set_disc(disc); // We don't do anything with the end here because it's already set to the end of the media file (if it exists) song->set_beginning_nanosec(beginning);