fix(settings): guard hotkey config lookup for missing plugin paths (#11422)

This commit is contained in:
Utkarsh Adhran
2026-07-11 11:37:41 +02:00
committed by GitHub
parent 1069978292
commit 1b1f8e034b
@@ -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
}