Compare vpos with 0 in ReadCommentsNiconico

This commit is contained in:
Star Brilliant 2013-09-20 15:08:58 +08:00
parent 34c1d6536a
commit 9101a1fe1d

View File

@ -124,7 +124,7 @@ def ReadCommentsNiconico(f, fontsize):
size = fontsize*0.64
elif mailstyle in NiconicoColorMap:
color = NiconicoColorMap[mailstyle]
yield (int(comment.getAttribute('vpos'))*0.01, int(comment.getAttribute('date')), int(comment.getAttribute('no')), c, pos, color, size, (c.count('\n')+1)*size, CalculateLength(c)*size)
yield (max(int(comment.getAttribute('vpos')), 0)*0.01, int(comment.getAttribute('date')), int(comment.getAttribute('no')), c, pos, color, size, (c.count('\n')+1)*size, CalculateLength(c)*size)
i += 1
except (AssertionError, AttributeError, IndexError, TypeError, ValueError):
logging.warning('Invalid comment: %s' % comment.toxml())