From 1b1f8e034b59b99a7a783e8c25e737b9407dcd1d Mon Sep 17 00:00:00 2001 From: Utkarsh Adhran Date: Sat, 11 Jul 2026 15:07:41 +0530 Subject: [PATCH] fix(settings): guard hotkey config lookup for missing plugin paths (#11422) --- .../components/hotkeySettingsTab.component.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tabby-settings/src/components/hotkeySettingsTab.component.ts b/tabby-settings/src/components/hotkeySettingsTab.component.ts index 4bd6464c..bf15bd78 100644 --- a/tabby-settings/src/components/hotkeySettingsTab.component.ts +++ b/tabby-settings/src/components/hotkeySettingsTab.component.ts @@ -35,17 +35,23 @@ export class HotkeySettingsTabComponent { } getHotkeys (id: string): Hotkey[] { - let ptr = this.config.store.hotkeys - for (const token of id.split(/\./g)) { - ptr = ptr[token] + let ptr: any = this.config.store.hotkeys + for (const token of id.split('.')) { + ptr = ptr?.[token] + if (ptr == null) { + return [] + } } - return (ptr || []).map(hotkey => this.detectDuplicates(hotkey)) + return Array.isArray(ptr) ? ptr.map(hotkey => this.detectDuplicates(hotkey)) : [] } setHotkeys (id: string, hotkeys: Hotkey[]) { - let ptr = this.config.store + let ptr: any = this.config.store let prop = 'hotkeys' for (const token of id.split(/\./g)) { + if (ptr[prop] == null || typeof ptr[prop] !== 'object' || Array.isArray(ptr[prop])) { + ptr[prop] = {} + } ptr = ptr[prop] prop = token }