THis fixes an exception when Greenshot is used via wine.

This commit is contained in:
Robin Krom 2021-01-02 21:53:47 +01:00 committed by Robin Krom
commit 633b31ec29

View file

@ -1374,6 +1374,10 @@ namespace GreenshotPlugin.Core {
// Make sure both images have the same resolution // Make sure both images have the same resolution
newImage.SetResolution(sourceImage.HorizontalResolution, sourceImage.VerticalResolution); newImage.SetResolution(sourceImage.HorizontalResolution, sourceImage.VerticalResolution);
} }
// In WINE someone getting the PropertyItems doesn't work
try
{
// Clone property items (EXIF information etc) // Clone property items (EXIF information etc)
foreach (var propertyItem in sourceImage.PropertyItems) foreach (var propertyItem in sourceImage.PropertyItems)
{ {
@ -1381,11 +1385,16 @@ namespace GreenshotPlugin.Core {
{ {
newImage.SetPropertyItem(propertyItem); newImage.SetPropertyItem(propertyItem);
} }
catch (Exception innerEx)
{
Log.Warn("Problem cloning a propertyItem.", innerEx);
}
}
}
catch (Exception ex) catch (Exception ex)
{ {
Log.Warn("Problem cloning a propertyItem.", ex); Log.Warn("Problem cloning a propertyItem.", ex);
} }
}
return newImage; return newImage;
} }