commit 74d4efc66417b001c64d85695e976b089eeea5f8
parent bfbd5434223c00b39e0f66a922111abd57aeaf25
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Sat, 26 Jan 2013 21:59:02 +0100
Fix crash when no parsing options were found
Thanks to p4bl0 for reporting this.
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/template.py b/template.py
@@ -166,10 +166,10 @@ class Template:
possible = map((lambda x: (self.rate(pattern, x), x)), possible)
possible = sorted(possible, key=(lambda x: x[0]))
- if len(possible) == 0 and quiet:
+ if quiet:
+ if len(possible) == 0:
return [None], pattern
- if (possible[0][0] > (1+len(pattern.hemistiches))*pattern.length/2
- and quiet):
+ if possible[0][0] > (1+len(pattern.hemistiches))*pattern.length/2:
return [None], pattern
# check metric