consider empty IResource.Extensions property.

This commit is contained in:
morkt 2016-02-05 06:10:46 +04:00
parent 693d4dfa59
commit c4f9c1ed47
3 changed files with 3 additions and 3 deletions

View File

@ -89,7 +89,7 @@ namespace GARbro.GUI
var filters = new StringBuilder();
var format = this.ArchiveFormat.SelectedItem as ArchiveFormat;
if (null != format)
if (null != format && format.Extensions.Any())
{
var patterns = format.Extensions.Select (ext => "*."+ext);
filters.Append (format.Description);

View File

@ -194,7 +194,7 @@ namespace GARbro.GUI
string source_ext = Path.GetExtension (filename).TrimStart ('.').ToLowerInvariant();
if (m_image_format.Extensions.Any (ext => ext == source_ext))
return;
string target_ext = m_image_format.Extensions.First();
string target_ext = m_image_format.Extensions.FirstOrDefault();
string target_name = Path.ChangeExtension (filename, target_ext);
using (var file = File.OpenRead (filename))
{

View File

@ -312,7 +312,7 @@ namespace GARbro.GUI
if (null == src_format)
throw new InvalidFormatException (string.Format ("{1}: {0}", guiStrings.MsgUnableInterpretImage, entry.Name));
file.Position = 0;
string target_ext = target_format.Extensions.First();
string target_ext = target_format.Extensions.FirstOrDefault() ?? "";
string outname = FindUniqueFileName (entry.Name, target_ext);
if (src_format.Item1 == target_format)
{