Fix crash in 'playlistinfo' when called with a songpos not matching an CPID (fixes #162)
This commit is contained in:
parent
6e9dd194df
commit
2262bf91d5
@ -14,6 +14,10 @@ v0.8 (in development)
|
||||
and various client support. Requires gevent, which currently is not a
|
||||
dependency of Mopidy.
|
||||
|
||||
- Fixed bug when the MPD command `playlistinfo` is used with a track position.
|
||||
Track position and CPID was intermixed, so it would cause a crash if a CPID
|
||||
matching the track position didn't exist. (Fixes: :issue:`162`)
|
||||
|
||||
|
||||
v0.7.3 (2012-08-11)
|
||||
===================
|
||||
|
||||
@ -243,7 +243,7 @@ def playlistinfo(context, songpos=None,
|
||||
"""
|
||||
if songpos is not None:
|
||||
songpos = int(songpos)
|
||||
cp_track = context.backend.current_playlist.get(cpid=songpos).get()
|
||||
cp_track = context.backend.current_playlist.cp_tracks.get()[songpos]
|
||||
return track_to_mpd_format(cp_track, position=songpos)
|
||||
else:
|
||||
if start is None:
|
||||
|
||||
@ -285,6 +285,8 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase):
|
||||
self.assertInResponse(u'OK')
|
||||
|
||||
def test_playlistinfo_with_songpos(self):
|
||||
# Make the track's CPID not match the playlist position
|
||||
self.backend.current_playlist.cp_id = 17
|
||||
self.backend.current_playlist.append([
|
||||
Track(name='a'), Track(name='b'), Track(name='c'),
|
||||
Track(name='d'), Track(name='e'), Track(name='f'),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user