check that old config is not null
This commit is contained in:
parent
27c4843904
commit
abb4cf44f4
@ -109,16 +109,18 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
|
||||
|
||||
using (var reader = XmlReader.Create(fileStream, settings))
|
||||
{
|
||||
var oldConfig = serializer.Deserialize(reader) as PluginConfiguration;
|
||||
if (serializer.Deserialize(reader) is PluginConfiguration oldConfig)
|
||||
{
|
||||
Instance.UpdateConfiguration(oldConfig);
|
||||
File.Delete(oldConfigFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Handle exceptions, such as file not found, deserialization errors, etc.
|
||||
_logger.LogWarning("Something stupid happend: {Exception}", ex);
|
||||
_logger.LogWarning("Something stupid happened: {Exception}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user