mirror of
https://github.com/greenshot/greenshot
synced 2025-07-06 04:52:16 -07:00
Added better error handling for reading the bitmap [skip ci]
This commit is contained in:
parent
9ae5598ab8
commit
78cbb055cb
1 changed files with 12 additions and 4 deletions
|
@ -86,11 +86,19 @@ namespace Greenshot.Editor.FileFormatHandlers
|
|||
bitmapStream.Write(fileHeaderBytes, 0, fileHeaderSize);
|
||||
bitmapStream.Write(dibBuffer, 0, dibBuffer.Length);
|
||||
bitmapStream.Seek(0, SeekOrigin.Begin);
|
||||
// TODO: Replace with a FileFormatHandler
|
||||
try
|
||||
{
|
||||
using var beforeCloneImage = Image.FromStream(bitmapStream);
|
||||
bitmap = ImageHelper.Clone(beforeCloneImage) as Bitmap;
|
||||
return bitmap != null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error("Problem retrieving Format17 from clipboard.", ex);
|
||||
bitmap = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Log.Info("Using special DIBV5 / Format17 format reader");
|
||||
// CF_DIBV5
|
||||
IntPtr gcHandle = IntPtr.Zero;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue