From 942e9f0bb42583a97360a9421d755b0241a7f010 Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Sat, 10 Oct 2020 11:28:25 +0100 Subject: [PATCH] apps: pager: Avoid crashes for notifications with no body Signed-off-by: Daniel Thompson --- wasp/apps/pager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wasp/apps/pager.py b/wasp/apps/pager.py index edb5418..db12b3f 100644 --- a/wasp/apps/pager.py +++ b/wasp/apps/pager.py @@ -89,7 +89,9 @@ class NotificationApp(PagerApp): id = next(iter(notes)) note = notes[id] del notes[id] - self._msg = '{}\n\n{}'.format(note['title'], note['body']) + title = note['title'] if 'title' in note else 'Untitled' + body = note['body'] if 'body' in note else '' + self._msg = '{}\n\n{}'.format(title, body) super().foreground()