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