diff --git a/GreenshotPlugin/Core/ClipboardHelper.cs b/GreenshotPlugin/Core/ClipboardHelper.cs
index 6e9162f19..a2462708d 100644
--- a/GreenshotPlugin/Core/ClipboardHelper.cs
+++ b/GreenshotPlugin/Core/ClipboardHelper.cs
@@ -811,19 +811,14 @@ EndSelection:<<<<<<<4
///
public static IEnumerable GetImageFilenames(IDataObject dataObject) {
string[] dropFileNames = (string[]) dataObject.GetData(DataFormats.FileDrop);
- if (dropFileNames != null && dropFileNames.Length > 0) {
- foreach (string filename in dropFileNames) {
- if (string.IsNullOrEmpty(filename))
- {
- continue;
- }
- string ext = Path.GetExtension(filename).ToLower().Substring(1);
- if (ImageHelper.StreamConverters.ContainsKey(ext))
- {
- yield return filename;
- }
- }
+ if (dropFileNames != null && dropFileNames.Length > 0)
+ {
+ return dropFileNames.Where(filename => !string.IsNullOrEmpty(filename))
+ .Where(Path.HasExtension)
+ .Select(filename => Path.GetExtension(filename).ToLowerInvariant())
+ .Where(ext => ImageHelper.StreamConverters.Keys.Contains(ext));
}
+ return Enumerable.Empty();
}
///