Fix error when opening menu if file size is null

This commit is contained in:
TheNain38 2016-01-15 19:50:02 +01:00
parent 8edbcb7a6c
commit c59bc0cb3a
1 changed files with 4 additions and 1 deletions

View File

@ -144,7 +144,10 @@ class UiWebsocketPlugin(object):
else:
size = size_filetypes.get(extension, 0)
size_other -= size
percent = 100 * (float(size) / size_total)
if size_total == 0:
percent = 0
else:
percent = 100 * (float(size) / size_total)
body.append(u"<li style='width: %.2f%%' class='%s back-%s' title='%s'></li>" % (percent, extension, color, extension))
# Legend