From c47063e92a65b10736086fa1d430e39da0bae9bb Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Mon, 29 Jun 2020 18:20:08 +0200 Subject: [PATCH] fix: themeManager - access potentially undefined function safely --- app/assets/javascripts/services/themeManager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/services/themeManager.ts b/app/assets/javascripts/services/themeManager.ts index 62f697901..1af5a15f0 100644 --- a/app/assets/javascripts/services/themeManager.ts +++ b/app/assets/javascripts/services/themeManager.ts @@ -16,7 +16,7 @@ const CACHED_THEMES_KEY = 'cachedThemes'; export class ThemeManager extends ApplicationService { private activeThemes: string[] = [] - private unsubState!: () => void + private unsubState?: () => void private unregisterDesktop!: () => void private unregisterComponent!: () => void @@ -44,7 +44,7 @@ export class ThemeManager extends ApplicationService { } deinit() { - this.unsubState(); + this.unsubState?.(); (this.unsubState as any) = undefined; this.activeThemes.length = 0; this.unregisterDesktop();