Fix for TUI crash bug #487

This commit is contained in:
Daniel Schwarz 2024-06-18 18:28:46 -04:00 committed by Ivan Habunek
parent 4ae9443174
commit 727fec415c
1 changed files with 10 additions and 9 deletions

View File

@ -484,15 +484,16 @@ class StatusDetails(urwid.Pile):
yield self.image_widget(m["url"], aspect=aspect) yield self.image_widget(m["url"], aspect=aspect)
yield urwid.Divider() yield urwid.Divider()
# video media may include a preview URL, show that as a fallback # video media may include a preview URL, show that as a fallback
elif m["preview_url"].lower().endswith(('.jpg', '.jpeg', '.png', '.gif', '.svg', '.webp')): elif m["preview_url"]:
yield urwid.Text("") if m["preview_url"].lower().endswith(('.jpg', '.jpeg', '.png', '.gif', '.svg', '.webp')):
try: yield urwid.Text("")
aspect = float(m["meta"]["small"]["aspect"]) try:
except Exception: aspect = float(m["meta"]["small"]["aspect"])
aspect = None except Exception:
if image_support_enabled(): aspect = None
yield self.image_widget(m["preview_url"], aspect=aspect) if image_support_enabled():
yield urwid.Divider() yield self.image_widget(m["preview_url"], aspect=aspect)
yield urwid.Divider()
yield ("pack", url_to_widget(m["url"])) yield ("pack", url_to_widget(m["url"]))
poll = status.original.data.get("poll") poll = status.original.data.get("poll")