db: Fix track_adjusts_current() when the track has been removed
In this case, the call to get_track_index() returns None which can't be used for the comparisons we're doing. Make sure we handle the None result explicitely. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
1296857189
commit
ab6eb556ad
|
@ -60,7 +60,10 @@ class Playlist(GObject.GObject):
|
|||
return cur.fetchone()[1] - 1
|
||||
|
||||
def track_adjusts_current(self, track):
|
||||
return self.current > -1 and self.get_track_index(track) <= self.current
|
||||
if self.current > -1:
|
||||
if (index := self.get_track_index(track)) != None:
|
||||
return index <= self.current
|
||||
return False
|
||||
|
||||
def add_track(self, track):
|
||||
self.emit("track-added", track)
|
||||
|
|
Loading…
Reference in New Issue