🐛Fix crashing if filter sends an IOException.

This commit is contained in:
2018-01-28 17:30:22 +00:00
parent 7ecdd1ae4e
commit 8e5d62f048

View File

@@ -32,6 +32,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using DiscImageChef.Console;
@@ -66,9 +67,10 @@ namespace DiscImageChef.Filters
/// <param name="path">Path</param>
/// <returns>The filter that allows reading the specified path</returns>
public IFilter GetFilter(string path)
{
try
{
IFilter noFilter = null;
foreach(IFilter filter in Filters.Values)
if(filter.Id != new Guid("12345678-AAAA-BBBB-CCCC-123456789000"))
{
@@ -81,7 +83,8 @@ namespace DiscImageChef.Filters
if(foundFilter?.IsOpened() == true) return foundFilter;
}
else noFilter = filter;
else
noFilter = filter;
if(!noFilter?.Identify(path) == true) return noFilter;
@@ -89,6 +92,8 @@ namespace DiscImageChef.Filters
return noFilter;
}
catch(IOException) { return null; }
}
/// <summary>
/// Gets all known filters