Fix get_rand_candidate crash
For some reason the loop in get_rand_candidate was exiting earlier than I thought. For now, I am returning the last ID looked at to fix the problem. I expect there is a better solution, but this seems to work until I can clean up the collection system.
This commit is contained in:
parent
aa9f517959
commit
025a118290
|
@ -123,13 +123,17 @@ class Playlist(collection.Collection):
|
|||
def get_rand_candidate(self):
|
||||
num = self.num_visible()
|
||||
next_idx = rand.randint(0, num-1)
|
||||
func = self.visible
|
||||
func = self.walk_filtered_ids
|
||||
if self.filtered == False:
|
||||
func = self.walk_ids
|
||||
for n in func():
|
||||
if next_idx == 0:
|
||||
return n
|
||||
next_idx -= 1
|
||||
# We shouldn't ever get here, but for some reason we are.
|
||||
# We return the last value of n, but I would like to figure
|
||||
# Out why we leave the loop early eventually.
|
||||
return n
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue