Skip to content
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixes

- Don't capture zero size screenshots ([#2459](https://github.com/getsentry/sentry-cocoa/pull/2459))

## 7.31.2

### Fixes
Expand Down
4 changes: 3 additions & 1 deletion Sources/Sentry/SentryScreenshot.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ - (void)saveScreenShots:(NSString *)path

if ([window drawViewHierarchyInRect:window.bounds afterScreenUpdates:false]) {
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
[result addObject:UIImagePNGRepresentation(img)];
if (img.size.width > 0 && img.size.height > 0) {
[result addObject:UIImagePNGRepresentation(img)];
}
}

UIGraphicsEndImageContext();
Expand Down