mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-08-04 15:28:23 +00:00
Check if file exists instead of catching exceptions
This commit is contained in:
parent
1a3543e5a5
commit
ffe79c8982
6 changed files with 73 additions and 99 deletions
|
|
@ -246,14 +246,15 @@ namespace Emby.Server.Implementations.AppBase
|
|||
|
||||
private object LoadConfiguration(string path, Type configurationType)
|
||||
{
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
return Activator.CreateInstance(configurationType);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return XmlSerializer.DeserializeFromFile(configurationType, path);
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
return Activator.CreateInstance(configurationType);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
return Activator.CreateInstance(configurationType);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue