mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
BUG-2080: Fix for an exception when a filename on the clipboard doesn't have an extension. [skip ci]
This commit is contained in:
parent
5c9fde65ed
commit
a91dc8a798
1 changed files with 7 additions and 12 deletions
|
@ -811,19 +811,14 @@ EndSelection:<<<<<<<4
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static IEnumerable<string> GetImageFilenames(IDataObject dataObject) {
|
public static IEnumerable<string> GetImageFilenames(IDataObject dataObject) {
|
||||||
string[] dropFileNames = (string[]) dataObject.GetData(DataFormats.FileDrop);
|
string[] dropFileNames = (string[]) dataObject.GetData(DataFormats.FileDrop);
|
||||||
if (dropFileNames != null && dropFileNames.Length > 0) {
|
if (dropFileNames != null && dropFileNames.Length > 0)
|
||||||
foreach (string filename in dropFileNames) {
|
|
||||||
if (string.IsNullOrEmpty(filename))
|
|
||||||
{
|
{
|
||||||
continue;
|
return dropFileNames.Where(filename => !string.IsNullOrEmpty(filename))
|
||||||
}
|
.Where(Path.HasExtension)
|
||||||
string ext = Path.GetExtension(filename).ToLower().Substring(1);
|
.Select(filename => Path.GetExtension(filename).ToLowerInvariant())
|
||||||
if (ImageHelper.StreamConverters.ContainsKey(ext))
|
.Where(ext => ImageHelper.StreamConverters.Keys.Contains(ext));
|
||||||
{
|
|
||||||
yield return filename;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return Enumerable.Empty<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue