From f2a12ff3c248be58d8e2a16395296f3ac743febf Mon Sep 17 00:00:00 2001 From: Bill Date: Sat, 25 Oct 2025 23:50:45 -0400 Subject: [PATCH] fix: add defensive check for isEncryptionAvailable method The isEncryptionAvailable() function was throwing "Cannot read properties of undefined" when safeStorage exists but doesn't have the isEncryptionAvailable method (can occur on some Electron versions). This was causing the entire settings UI to fail rendering after the Authentication heading, hiding all API key management controls. Fix: Add typeof check before calling safeStorage.isEncryptionAvailable() to ensure the method exists before attempting to call it. --- src/utils/encryption-utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/encryption-utils.ts b/src/utils/encryption-utils.ts index de3adad..823b967 100644 --- a/src/utils/encryption-utils.ts +++ b/src/utils/encryption-utils.ts @@ -70,5 +70,7 @@ export function decryptApiKey(stored: string): string { * @returns true if safeStorage encryption is available */ export function isEncryptionAvailable(): boolean { - return safeStorage !== null && safeStorage.isEncryptionAvailable(); + return safeStorage !== null && + typeof safeStorage.isEncryptionAvailable === 'function' && + safeStorage.isEncryptionAvailable(); }