From 21f1895596e4c64e24f4a3c342d00d586b4e2b51 Mon Sep 17 00:00:00 2001 From: BerndK Date: Wed, 6 May 2015 10:19:20 +0200 Subject: [PATCH] Bugfix: empty folder --- SvgToXaml/SvgToXaml.csproj | 3 ++- SvgToXaml/ViewModels/SvgImagesViewModel.cs | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/SvgToXaml/SvgToXaml.csproj b/SvgToXaml/SvgToXaml.csproj index f77f644..e5b375c 100644 --- a/SvgToXaml/SvgToXaml.csproj +++ b/SvgToXaml/SvgToXaml.csproj @@ -29,13 +29,14 @@ AnyCPU - pdbonly + none true bin\Release\ TRACE prompt 4 false + true SvgToXaml.Program diff --git a/SvgToXaml/ViewModels/SvgImagesViewModel.cs b/SvgToXaml/ViewModels/SvgImagesViewModel.cs index 24a0bd1..b99c17f 100644 --- a/SvgToXaml/ViewModels/SvgImagesViewModel.cs +++ b/SvgToXaml/ViewModels/SvgImagesViewModel.cs @@ -126,7 +126,16 @@ private void ReadImagesFromDir(string folder) private static string[] GetFilesMulti(string sourceFolder, string filters, System.IO.SearchOption searchOption = SearchOption.TopDirectoryOnly) { - return filters.Split('|').SelectMany(filter => System.IO.Directory.GetFiles(sourceFolder, filter, searchOption)).ToArray(); + try + { + if (!Directory.Exists(sourceFolder)) + return new string[0]; + return filters.Split('|').SelectMany(filter => Directory.GetFiles(sourceFolder, filter, searchOption)).ToArray(); + } + catch (Exception) + { + return new string[0]; + } } } }