username might be undefined

This commit is contained in:
j 2016-03-13 18:45:08 +01:00
parent dc65b74389
commit 635e718708

View file

@ -423,7 +423,7 @@ class Changelog(db.Model):
if len(peer_id) == 16:
peer = User.get(peer_id)
if peer:
username = peer.json()['username']
username = peer.json().get('username', 'anonymous')
action[peer_id] = [revision, timestamp, username]
if peer_id in changes.get('removepeer', []):
del changes['removepeer'][peer_id]