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

Fix: Remove crash on unknown theme version #219

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/lib/clmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ user.subscribe(v => {
if (_userLoaded) {
_user = v;
if (_user.theme.startsWith("custom:")) {
applyTheme(stringToTheme(_user.theme));
try {
applyTheme(stringToTheme(_user.theme));
} catch (e) {
console.error(`Failed to apply custom theme: ${e}`);
removeTheme();
}
} else {
removeTheme();
}
Expand Down
14 changes: 12 additions & 2 deletions src/lib/modals/settings/CustomTheme.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@
<Modal
on:close={() => {
if ($user.theme.includes("custom:")) {
applyTheme(stringToTheme($user.theme));
try {
applyTheme(stringToTheme($user.theme));
} catch (e) {
console.error(`Failed to apply custom theme: ${e}`);
removeTheme();
}
} else {
removeTheme();
}
Expand Down Expand Up @@ -83,7 +88,12 @@
<button
on:click={() => {
if ($user.theme.includes("custom:")) {
applyTheme(stringToTheme($user.theme));
try {
applyTheme(stringToTheme($user.theme));
} catch (e) {
console.error(`Failed to apply custom theme: ${e}`);
removeTheme();
}
} else {
removeTheme();
}
Expand Down