Fix track times bug
When update_track_times runs, it looks as track_sequence.current and .next, but didn't check that those tracks referred to the current playlist, which could cause a KeyError. Fixes #252
This commit is contained in:
parent
04c2c6377a
commit
1513ad96d8
@ -1109,7 +1109,7 @@ class PlaylistModel(QAbstractTableModel):
|
||||
track_sequence.current,
|
||||
track_sequence.previous,
|
||||
]:
|
||||
if ts and ts.row_number:
|
||||
if ts and ts.playlist_id == self.playlist_id and ts.row_number:
|
||||
plr = session.get(PlaylistRows, ts.plr_id)
|
||||
if plr and plr.plr_rownum != ts.row_number:
|
||||
ts.row_number = plr.plr_rownum
|
||||
@ -1472,7 +1472,7 @@ class PlaylistModel(QAbstractTableModel):
|
||||
|
||||
current_track_row = None
|
||||
next_track_row = None
|
||||
if track_sequence.current:
|
||||
if track_sequence.current and track_sequence.current.playlist_id == self.playlist_id:
|
||||
current_track_row = track_sequence.current.row_number
|
||||
# Update current track details now so that they are available
|
||||
# when we deal with next track row which may be above current
|
||||
@ -1481,7 +1481,7 @@ class PlaylistModel(QAbstractTableModel):
|
||||
update_rows, track_sequence.current.start_time
|
||||
)
|
||||
|
||||
if track_sequence.next:
|
||||
if track_sequence.next and track_sequence.next.playlist_id == self.playlist_id:
|
||||
next_track_row = track_sequence.next.row_number
|
||||
|
||||
for row_number in range(row_count):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user