From a377c69d5fd38a228281960bf6638cf45cb2536f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3bert=20Kiss?= Date: Sat, 7 Oct 2023 22:43:57 +0200 Subject: [PATCH] fix: crash if changing theme before default user config loaded (#2102) --- .../store/reducers/default-user-configuration.reducer.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/uhk-web/src/app/store/reducers/default-user-configuration.reducer.ts b/packages/uhk-web/src/app/store/reducers/default-user-configuration.reducer.ts index ff6bcffe592..226eb957d14 100644 --- a/packages/uhk-web/src/app/store/reducers/default-user-configuration.reducer.ts +++ b/packages/uhk-web/src/app/store/reducers/default-user-configuration.reducer.ts @@ -34,6 +34,14 @@ export function reducer(state = initialState, action: Actions | AppActions.Actio case AppActions.ActionTypes.SetAppTheme: { const theme = (action as AppActions.SetAppThemeAction).payload; + + if (!state.userConfiguration) { + return { + ...state, + theme + }; + } + const userConfiguration = state.userConfiguration.clone(); setSvgKeyboardCoverColorsOfAllLayer(userConfiguration, theme);