Skip to content

Commit

Permalink
Actually check the theme extends field value
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Sep 9, 2024
1 parent f545851 commit f5ec9ee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/model/ui/ui-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,12 @@ export class UiStore {
if (!themeData) throw new Error("Could not parse theme JSON");

if (!themeData.name) throw new Error('Theme must contain a `name` field');
if (!themeData.extends) throw new Error('Theme must contain an `extends` field with a built-in theme name (dark/light/high-contrast)');
if (
!themeData.extends ||
Themes[themeData.extends as ThemeName] === undefined
) {
throw new Error('Theme must contain an `extends` field with a built-in theme name (dark/light/high-contrast)');
}

const baseTheme = Themes[themeData.extends];
return {
Expand Down

0 comments on commit f5ec9ee

Please sign in to comment.