Fix blank lines in damage types import
If the text variable contains blank lines like for example ending with a newline character or having two consecutive newline characters the fields dict is empty and DamagePattern fails with an Exception. This closes #124
This commit is contained in:
@@ -79,10 +79,10 @@ class DamagePattern(object):
|
||||
key, val = entry.split(':')
|
||||
fields["%sAmount" % cls.importMap[key.lower()]] = float(val)
|
||||
|
||||
pattern = DamagePattern(**fields)
|
||||
pattern.name = name
|
||||
patterns.append(pattern)
|
||||
|
||||
if len(fields) > 0: # Avoid possible blank lines
|
||||
pattern = DamagePattern(**fields)
|
||||
pattern.name = name
|
||||
patterns.append(pattern)
|
||||
return patterns
|
||||
|
||||
EXPORT_FORMAT = "%s = EM:%d, Therm:%d, Kin:%d, Exp:%d\n"
|
||||
|
||||
Reference in New Issue
Block a user