aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2019-01-27 17:00:17 +0100
committerBond_009 <bond.009@outlook.com>2019-01-27 17:00:17 +0100
commitffe79c89829fb232e8ccb4ae4caf4b732ce51600 (patch)
tree6938e3f5ebae59fe4baec81e4583abbef3371dae /Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
parent1a3543e5a5984d4ec5284f43b7df63a9d19c8a9c (diff)
Check if file exists instead of catching exceptions
Diffstat (limited to 'Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs')
-rw-r--r--Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
index 59c7c655f..9740f5ee3 100644
--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
@@ -246,13 +246,14 @@ namespace Emby.Server.Implementations.AppBase
private object LoadConfiguration(string path, Type configurationType)
{
- try
+ if (!File.Exists(path))
{
- return XmlSerializer.DeserializeFromFile(configurationType, path);
+ return Activator.CreateInstance(configurationType);
}
- catch (FileNotFoundException)
+
+ try
{
- return Activator.CreateInstance(configurationType);
+ return XmlSerializer.DeserializeFromFile(configurationType, path);
}
catch (IOException)
{