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>
|
||||
public static IEnumerable<string> 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))
|
||||
if (dropFileNames != null && dropFileNames.Length > 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string ext = Path.GetExtension(filename).ToLower().Substring(1);
|
||||
if (ImageHelper.StreamConverters.ContainsKey(ext))
|
||||
{
|
||||
yield return filename;
|
||||
}
|
||||
}
|
||||
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<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue