fix: handle undefined safeStorage and remove diagnostic logging

Root cause: electron.safeStorage was undefined (not null) when the
property doesn't exist, causing "Cannot read properties of undefined"
error when accessing isEncryptionAvailable.

Fix: Normalize undefined to null with `|| null` operator when importing
safeStorage, ensuring consistent null checks throughout the code.

Changes:
- Set safeStorage to null if electron.safeStorage is undefined
- Remove all diagnostic try-catch blocks from settings UI
- Remove console.log debugging statements
- Restore clean code that now works correctly

This resolves the settings UI crash that prevented the API key
management section from displaying.
This commit is contained in:
2025-10-26 00:16:35 -04:00
parent efd1ff306e
commit 779b3d6e8c
2 changed files with 57 additions and 81 deletions

View File

@@ -2,7 +2,7 @@
let safeStorage: any = null;
try {
const electron = require('electron');
safeStorage = electron.safeStorage;
safeStorage = electron.safeStorage || null;
} catch (error) {
console.warn('Electron safeStorage not available, API keys will be stored in plaintext');
}