From 11b960e22c5b191670acc8fee1b36a2ad7c307b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Mon, 14 Jan 2019 17:12:49 +0100 Subject: [PATCH] server: Fix device printing if some fields are None. --- matrix/server.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/matrix/server.py b/matrix/server.py index f6cfd2f..94ff6e2 100644 --- a/matrix/server.py +++ b/matrix/server.py @@ -1001,9 +1001,11 @@ class MatrixServer(object): lines = [] for device in response.devices: + last_seen_date = ("?" if not device.last_seen_date else + device.last_seen_date.strftime("%Y/%m/%d %H:%M")) last_seen = "{ip} @ {date}".format( - ip=device.last_seen_ip, - date=device.last_seen_date.strftime("%Y/%m/%d %H:%M") + ip=device.last_seen_ip or "?", + date=last_seen_date ) device_color = ("chat_self" if device.id == self.device_id else W.info_get("nick_color_name", device.id)) @@ -1013,7 +1015,7 @@ class MatrixServer(object): W.color(device_color), device.id, W.color("resetcolor"), - device.display_name, + device.display_name or "", last_seen ) lines.append(line)