File tree Expand file tree Collapse file tree 2 files changed +10
-35
lines changed
Expand file tree Collapse file tree 2 files changed +10
-35
lines changed Original file line number Diff line number Diff line change @@ -99,29 +99,19 @@ public static void Load()
9999 }
100100 else
101101 {
102- Current = JsonSerializer . Deserialize < LocalSettingsInfo > ( jsonString , JsonOptions ) ;
103-
104- // Check if deserialization returned null (e.g., file contains "null")
105- if ( Current == null )
106- {
107- Log . Warn ( "Local settings deserialized to null, initializing new local settings." ) ;
108- }
109- else
110- {
111- Log . Info ( "Local settings loaded successfully." ) ;
112-
113- // Reset change tracking
114- Current . SettingsChanged = false ;
115-
116- return ;
117- }
102+ Current = JsonSerializer . Deserialize < LocalSettingsInfo > ( jsonString , JsonOptions ) ?? new LocalSettingsInfo ( ) ;
103+
104+ Log . Info ( "Local settings loaded successfully." ) ;
105+
106+ // Reset change tracking
107+ Current . SettingsChanged = false ;
108+
109+ return ;
118110 }
119111 }
120112 catch ( Exception ex )
121113 {
122- {
123- Log . Error ( $ "Failed to load local settings from: { filePath } ", ex ) ;
124- }
114+ Log . Error ( $ "Failed to load local settings from: { filePath } ", ex ) ;
125115 }
126116 }
127117
Original file line number Diff line number Diff line change @@ -87,22 +87,7 @@ by BornToBeRoot
8787 PolicyManager . Load ( ) ;
8888
8989 // Load (or initialize) local settings
90- try
91- {
92- LocalSettingsManager . Load ( ) ;
93- }
94- catch ( IOException ex )
95- {
96- Log . Error ( "Could not load local settings due to an I/O error! Using default local settings." , ex ) ;
97- }
98- catch ( UnauthorizedAccessException ex )
99- {
100- Log . Error ( "Could not load local settings due to insufficient permissions! Using default local settings." , ex ) ;
101- }
102- catch ( JsonException ex )
103- {
104- Log . Error ( "Could not load local settings! Local settings JSON is corrupted or invalid. Using default local settings." , ex ) ;
105- }
90+ LocalSettingsManager . Load ( ) ;
10691
10792 // Load (or initialize) settings
10893 try
You can’t perform that action at this time.
0 commit comments