From f5ec9ee2a668930564499212cbc12b0f63fe00ee Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Mon, 9 Sep 2024 14:58:51 +0200 Subject: [PATCH] Actually check the theme extends field value --- src/model/ui/ui-store.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/model/ui/ui-store.ts b/src/model/ui/ui-store.ts index b7d67faf..557c85cb 100644 --- a/src/model/ui/ui-store.ts +++ b/src/model/ui/ui-store.ts @@ -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 {