From bb9b81aa37778593df69586ee33164cae51a0dea Mon Sep 17 00:00:00 2001 From: Brendan Allan <14191578+Brendonovich@users.noreply.github.com> Date: Tue, 5 May 2026 18:24:21 +0800 Subject: [PATCH] fix(desktop): add error handling to store-get IPC handler (#25850) --- packages/desktop/src/main/ipc.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/desktop/src/main/ipc.ts b/packages/desktop/src/main/ipc.ts index 2413613730..1c4af0eb60 100644 --- a/packages/desktop/src/main/ipc.ts +++ b/packages/desktop/src/main/ipc.ts @@ -70,10 +70,14 @@ export function registerIpcHandlers(deps: Deps) { ipcMain.handle("install-update", () => deps.installUpdate()) ipcMain.handle("set-background-color", (_event: IpcMainInvokeEvent, color: string) => deps.setBackgroundColor(color)) ipcMain.handle("store-get", (_event: IpcMainInvokeEvent, name: string, key: string) => { - const store = getStore(name) - const value = store.get(key) - if (value === undefined || value === null) return null - return typeof value === "string" ? value : JSON.stringify(value) + try { + const store = getStore(name) + const value = store.get(key) + if (value === undefined || value === null) return null + return typeof value === "string" ? value : JSON.stringify(value) + } catch { + return null + } }) ipcMain.handle("store-set", (_event: IpcMainInvokeEvent, name: string, key: string, value: string) => { getStore(name).set(key, value)