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.
This commit is contained in:
2025-10-25 23:50:45 -04:00
parent f6234c54b0
commit f2a12ff3c2

View File

@@ -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();
}