Skip to content

Commit

Permalink
Check for existance of key in dictionary
Browse files Browse the repository at this point in the history
as well as non-null value to avoid uncaught KeyError

re: issue #116
  • Loading branch information
Your Name authored and ihabunek committed Sep 7, 2019
1 parent 9d0d1b2 commit 7fc3937
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion toot/tui/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def build_linebox(self, contents):

def card_generator(self, card):
yield urwid.Text(("green", card["title"].strip()))
if card["author_name"]:
if card.get("author_name"):
yield urwid.Text(["by ", ("yellow", card["author_name"].strip())])
yield urwid.Text("")
if card["description"]:
Expand Down

0 comments on commit 7fc3937

Please sign in to comment.