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:
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user