File tree Expand file tree Collapse file tree 1 file changed +17
-16
lines changed
managed/CounterStrikeSharp.API/Core Expand file tree Collapse file tree 1 file changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -151,27 +151,28 @@ public void Load()
151151 _commandsRegistered = true ;
152152 }
153153
154- if ( ! File . Exists ( _coreConfigPath ) )
154+ if ( File . Exists ( _coreConfigPath ) )
155155 {
156- _logger . LogWarning (
157- "Core configuration could not be found at path \" {CoreConfigPath}\" , fallback values will be used." ,
158- _coreConfigPath ) ;
159- return ;
160- }
161-
162- try
163- {
164- var data = JsonSerializer . Deserialize < CoreConfigData > ( File . ReadAllText ( _coreConfigPath ) ,
165- new JsonSerializerOptions ( ) { ReadCommentHandling = JsonCommentHandling . Skip } ) ;
166-
167- if ( data != null )
156+ try
157+ {
158+ var data = JsonSerializer . Deserialize < CoreConfigData > ( File . ReadAllText ( _coreConfigPath ) ,
159+ new JsonSerializerOptions ( ) { ReadCommentHandling = JsonCommentHandling . Skip } ) ;
160+
161+ if ( data != null )
162+ {
163+ _coreConfig = data ;
164+ }
165+ }
166+ catch ( Exception ex )
168167 {
169- _coreConfig = data ;
168+ _logger . LogWarning ( ex , "Failed to load core configuration, fallback values will be used" ) ;
170169 }
171170 }
172- catch ( Exception ex )
171+ else
173172 {
174- _logger . LogWarning ( ex , "Failed to load core configuration, fallback values will be used" ) ;
173+ _logger . LogWarning (
174+ "Core configuration could not be found at path \" {CoreConfigPath}\" , fallback values will be used." ,
175+ _coreConfigPath ) ;
175176 }
176177
177178 var serverCulture = CultureInfo . GetCultures ( CultureTypes . AllCultures )
You can’t perform that action at this time.
0 commit comments