Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

Commit

Permalink
fix(ui): ensure finding theme provider doesn't crash thread (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored Mar 14, 2024
1 parent 85e1575 commit 51e39f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Contents/Code/general_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,19 @@ def get_theme_provider(item):
}

if not item.themes():
Log.Debug('No themes found for item: {}'.format(item.title))
return

provider = None

selected = (theme for theme in item.themes() if theme.selected).next()
selected = None
for theme in item.themes():
if getattr(theme, 'selected'):
selected = theme
break
if not selected:
Log.Debug('No selected theme found for item: {}'.format(item.title))
return

if selected.provider in provider_map.keys():
provider = provider_map[selected.provider]
Expand Down
4 changes: 3 additions & 1 deletion Contents/Code/webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ def cache_data():
else:
theme_status = 'missing'

theme_provider = general_helper.get_theme_provider(item=item)

items[section.key]['items'].append(dict(
title=item.title,
agent=item_agent,
Expand All @@ -352,7 +354,7 @@ def cache_data():
issue_action=issue_action,
issue_url=item_issue_url,
theme=True if item.theme else False,
theme_provider=general_helper.get_theme_provider(item=item),
theme_provider=theme_provider,
theme_status=theme_status,
type=item.type,
year=year,
Expand Down

0 comments on commit 51e39f6

Please sign in to comment.