Alleviate #185: except on UI KeyError

This commit is contained in:
Armen Boursalian 2018-08-16 22:14:07 -07:00
parent f4162b9384
commit d206a6430d

View file

@ -201,7 +201,12 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
by_users = {}
if self._address is None:
for uid, hits in self._stats.by_uid.items():
by_users["%s (%s)" % (pwd.getpwuid(int(uid)).pw_name, uid)] = hits
try:
pw_name = pwd.getpwall(int(uid)).pw_name
except KeyError:
pw_name = "(UID error)"
finally:
by_users["%s (%s)" % (pw_name, uid)] = hits
else:
by_users = self._stats.by_uid