Skip to content

Commit

Permalink
Merge 9a77f8a into 9ba19c0
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich authored Nov 29, 2022
2 parents 9ba19c0 + 9a77f8a commit d15071c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixes

- Don't capture zero size screenshots ([#2459](https://github.com/getsentry/sentry-cocoa/pull/2459))
- Reporting crashes when restarting the SDK (#2440)
- Core data span status with error (#2439)

Expand Down
7 changes: 6 additions & 1 deletion Sources/Sentry/SentryScreenshot.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ - (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) {
NSData *bytes = UIImagePNGRepresentation(img);
if (bytes && bytes.length > 0) {
[result addObject:bytes];
}
}
}

UIGraphicsEndImageContext();
Expand Down

0 comments on commit d15071c

Please sign in to comment.