Use default theme if theme function not found

merge-requests/8/head
Bob Mottram 2020-11-14 17:01:25 +00:00
parent 3f4d72c6e0
commit 933c3d965f
1 changed files with 10 additions and 1 deletions

View File

@ -1404,7 +1404,16 @@ def setTheme(baseDir: str, name: str, domain: str) -> bool:
for themeName in themes:
themeNameLower = themeName.lower()
if name == themeNameLower:
globals()['setTheme' + themeName](baseDir)
themeFunctionExists = False
try:
globals()['setTheme' + themeName](baseDir)
themeFunctionExists = True
except BaseException:
pass
if not themeFunctionExists:
setThemeDefault(baseDir)
if prevThemeName:
if prevThemeName.lower() != themeNameLower:
# change the banner and profile image