Fix artist search and match on row zero

This commit is contained in:
Keith Edmunds 2022-08-14 22:45:00 +01:00
parent 23af906d95
commit 8fedb394a4

View File

@ -797,7 +797,7 @@ class PlaylistTab(QTableWidget):
return
selected_row = self._get_selected_row()
if selected_row and selected_row < self.rowCount() - 1:
if selected_row is not None and selected_row < self.rowCount() - 1:
starting_row = selected_row + 1
else:
starting_row = 0
@ -812,7 +812,7 @@ class PlaylistTab(QTableWidget):
if title and needle in title.lower():
match_row = row
break
artist = self._get_row_title(row)
artist = self._get_row_artist(row)
if artist and needle in artist.lower():
match_row = row
break
@ -827,7 +827,7 @@ class PlaylistTab(QTableWidget):
row = 0
wrapped = True
if match_row:
if match_row is not None:
self.selectRow(row)
def search_previous(self) -> None:
@ -842,7 +842,7 @@ class PlaylistTab(QTableWidget):
return
selected_row = self._get_selected_row()
if selected_row and selected_row > 0:
if selected_row is not None and selected_row > 0:
starting_row = selected_row - 1
else:
starting_row = self.rowCount() - 1
@ -872,7 +872,7 @@ class PlaylistTab(QTableWidget):
row = self.rowCount() - 1
wrapped = True
if match_row:
if match_row is not None:
self.selectRow(row)
def select_next_row(self) -> None: