Skip to content

Commit fecdccc

Browse files
committed
fixup! Playlists: keep correct track selection (position) when sorting
1 parent fe9c71d commit fecdccc

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/library/basesqltablemodel.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ void BaseSqlTableModel::select() {
265265
// the the first column always contains the id?
266266
DEBUG_ASSERT(idColumn == kIdColumn);
267267

268-
VERIFY_OR_DEBUG_ASSERT(idColumn >= 0) {
268+
VERIFY_OR_DEBUG_ASSERT(idColumn != -1) {
269269
qCritical()
270270
<< "ID column not available in database query results:"
271271
<< m_idColumn;
@@ -280,10 +280,10 @@ void BaseSqlTableModel::select() {
280280
// current position defines the ordering
281281
rowInfo.order = rowInfos.size();
282282

283-
if (posColumn < 0 && !m_positionColumn.isEmpty()) {
283+
if (posColumn == -1 && !m_positionColumn.isEmpty()) {
284284
posColumn = sqlRecord.indexOf(m_positionColumn);
285285
}
286-
if (posColumn >= 0) {
286+
if (posColumn != -1) {
287287
bool ok = false;
288288
int pos = sqlRecord.value(posColumn).toInt(&ok);
289289
if (ok) {
@@ -351,7 +351,7 @@ void BaseSqlTableModel::select() {
351351
DEBUG_ASSERT(trackIdToRows.size() <= rowInfos.size());
352352

353353
TrackPos2Row trackPosToRows;
354-
if (posColumn >= 0) {
354+
if (posColumn != -1) {
355355
// We expect as many positions as we have rows
356356
trackPosToRows.reserve(rowInfos.size());
357357
for (int i = 0; i < rowInfos.size(); ++i) {

0 commit comments

Comments
 (0)