mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[Thumbnail providers] Cover errors and edge cases (#23947)
* [Thumbnail providers] Cover errors and edge cases * Add TODO comment * Fix tests
This commit is contained in:
@@ -130,19 +130,10 @@ namespace Microsoft.PowerToys.ThumbnailHandler.Stl
|
||||
return null;
|
||||
}
|
||||
|
||||
using (var memStream = new MemoryStream())
|
||||
Bitmap thumbnail = GetThumbnail(this.Stream, cx);
|
||||
if (thumbnail != null && thumbnail.Size.Width > 0 && thumbnail.Size.Height > 0)
|
||||
{
|
||||
this.Stream.CopyTo(memStream);
|
||||
|
||||
memStream.Position = 0;
|
||||
|
||||
using (Bitmap thumbnail = GetThumbnail(memStream, cx))
|
||||
{
|
||||
if (thumbnail != null && thumbnail.Size.Width > 0 && thumbnail.Size.Height > 0)
|
||||
{
|
||||
return (Bitmap)thumbnail.Clone();
|
||||
}
|
||||
}
|
||||
return thumbnail;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user