diff --git a/src/library/dao/cuedao.cpp b/src/library/dao/cuedao.cpp index f73f17767db..596cdd7f248 100644 --- a/src/library/dao/cuedao.cpp +++ b/src/library/dao/cuedao.cpp @@ -39,7 +39,7 @@ inline QString labelFromQVariant(const QVariant& value) { CuePointer cueFromRow(const QSqlRecord& row) { const auto id = DbId(row.value(row.indexOf("id"))); TrackId trackId(row.value(row.indexOf("track_id"))); - int type = row.value(row.indexOf("type")).toInt(); + auto type = static_cast(row.value(row.indexOf("type")).toInt()); double position = row.value(row.indexOf("position")).toDouble(); int length = row.value(row.indexOf("length")).toInt(); int hotcue = row.value(row.indexOf("hotcue")).toInt(); @@ -48,9 +48,19 @@ CuePointer cueFromRow(const QSqlRecord& row) { VERIFY_OR_DEBUG_ASSERT(color) { return CuePointer(); } + if (type == mixxx::CueType::Loop && length == 0) { + // These entries are likely added via issue #11283 + qWarning() << "Discard loop cue" << hotcue << "found in database with length of 0"; + return CuePointer(); + } + if (type == mixxx::CueType::HotCue && position == 0 && *color == mixxx::RgbColor(0)) { + // These entries are likely added via issue #11283 + qWarning() << "Discard black hot cue" << hotcue << "found in database at position 0"; + return CuePointer(); + } CuePointer pCue(new Cue(id, trackId, - static_cast(type), + type, position, length, hotcue, @@ -81,7 +91,7 @@ QList CueDAO::getCuesForTrack(TrackId trackId) const { QMap hotCuesByNumber; while (query.next()) { CuePointer pCue = cueFromRow(query.record()); - VERIFY_OR_DEBUG_ASSERT(pCue) { + if (!pCue) { continue; } int hotCueNumber = pCue->getHotCue(); diff --git a/src/track/serato/tags.cpp b/src/track/serato/tags.cpp index de16901de21..71905f31414 100644 --- a/src/track/serato/tags.cpp +++ b/src/track/serato/tags.cpp @@ -207,7 +207,22 @@ QList SeratoTags::getCueInfos() const { if (!index) { continue; } - + if (cueInfo.getType() == mixxx::CueType::Loop && + (!cueInfo.getEndPositionMillis() || + *cueInfo.getEndPositionMillis() == 0)) { + // These entries are likely added via issue #11283 + qWarning() << "Discard loop cue" << index << "found in markers2 with length of 0"; + continue; + } + if (cueInfo.getType() == mixxx::CueType::HotCue && + (!cueInfo.getStartPositionMillis() || + *cueInfo.getStartPositionMillis() == 0) && + (!cueInfo.getColor() || + *cueInfo.getColor() == mixxx::RgbColor(0))) { + // These entries are likely added via issue #11283 + qWarning() << "Discard black hot cue" << index << "found in markers2 at position 0"; + continue; + } CueInfo newCueInfo(cueInfo); newCueInfo.setHotCueIndex(index); cueMap.insert(*index, newCueInfo); @@ -237,6 +252,22 @@ QList SeratoTags::getCueInfos() const { if (!index) { continue; } + if (cueInfo.getType() == mixxx::CueType::Loop && + (!cueInfo.getEndPositionMillis() || + *cueInfo.getEndPositionMillis() == 0)) { + // These entries are likely added via issue #11283 + qWarning() << "Discard loop cue" << index << "found in markers with length of 0"; + continue; + } + if (cueInfo.getType() == mixxx::CueType::HotCue && + (!cueInfo.getStartPositionMillis() || + *cueInfo.getStartPositionMillis() == 0) && + (!cueInfo.getColor() || + *cueInfo.getColor() == mixxx::RgbColor(0))) { + // These entries are likely added via issue #11283 + qWarning() << "Discard black hot cue" << index << "found in markers at position 0"; + continue; + } // Take a pre-existing CueInfo object that was read from // "SeratoMarkers2" from the CueMap (or a default constructed CueInfo