Fix errors occured when the attribute 'no' doesn't exist

This commit is contained in:
uohlhv 2021-11-13 09:49:53 +08:00
parent f71ef49f26
commit b53fc11b37

View File

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