File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -253,14 +253,28 @@ public void DiscoverMods(string modsFilePath)
253253 List < ModKeyInfo > modKeysCache = new List < ModKeyInfo > ( ) ;
254254 if ( File . Exists ( Pathing . GetKeyCachePath ( ) ) )
255255 {
256- modKeysCache = JsonSerializer . Deserialize < List < ModKeyInfo > > ( File . ReadAllText ( Pathing . GetKeyCachePath ( ) ) , new JsonSerializerOptions { AllowTrailingCommas = true } ) ;
256+ try
257+ {
258+ modKeysCache = JsonSerializer . Deserialize < List < ModKeyInfo > > ( File . ReadAllText ( Pathing . GetKeyCachePath ( ) ) , new JsonSerializerOptions { AllowTrailingCommas = true } ) ;
259+ }
260+ catch ( Exception ex )
261+ {
262+ Program . helper . Log ( $ "Failed to parse cached mod keys: { ex } ", Helper . Status . Alert ) ;
263+ }
257264 }
258265
259266 // Get the local data
260267 ClientData localDataCache = new ClientData ( ) ;
261268 if ( File . Exists ( Pathing . GetDataCachePath ( ) ) )
262269 {
263- localDataCache = JsonSerializer . Deserialize < ClientData > ( File . ReadAllText ( Pathing . GetDataCachePath ( ) ) , new JsonSerializerOptions { AllowTrailingCommas = true } ) ;
270+ try
271+ {
272+ localDataCache = JsonSerializer . Deserialize < ClientData > ( File . ReadAllText ( Pathing . GetDataCachePath ( ) ) , new JsonSerializerOptions { AllowTrailingCommas = true } ) ;
273+ }
274+ catch ( Exception ex )
275+ {
276+ Program . helper . Log ( $ "Failed to parse client data: { ex } ", Helper . Status . Alert ) ;
277+ }
264278 }
265279
266280 foreach ( var fileInfo in GetManifestFiles ( new DirectoryInfo ( modsFilePath ) ) )
You can’t perform that action at this time.
0 commit comments