diff --git a/pl.py b/pl.py
index 86af355..bc99cc4 100755
--- a/pl.py
+++ b/pl.py
@@ -241,8 +241,9 @@ def playlist_is_ok(playlist, options):
new=missing_item[len(options.target):])
else:
print "could be"
- nbr_of_suggestions = 5
- for sugg_idx in range(nbr_of_suggestions):
+ max_suggs = 5
+ nbr_suggs = min(max_suggs, len(suggs))
+ for sugg_idx in range(nbr_suggs):
if options.fix:
print sugg_idx + 1,
print format_item(suggs[sugg_idx],
@@ -250,7 +251,7 @@ def playlist_is_ok(playlist, options):
indent=4)
if options.fix:
message = 'Which one to use? [%s, nothing to ignore] '
- seq = ''.join([str(num + 1) for num in range(nbr_of_suggestions)])
+ seq = ''.join([str(num + 1) for num in range(nbr_suggs)])
replace = raw_input(message % seq)
if replace.strip():
try:
@@ -258,7 +259,7 @@ def playlist_is_ok(playlist, options):
except:
number = -1
else:
- if 0 <= number < nbr_of_suggestions:
+ if 0 <= number < nbr_suggs:
new_playlist = replace_in_pl(
pl=new_playlist,
entry=missing_item[len(options.target):],