Skip to content

Return a conversion failure error when CGImageCreate fails#205

Merged
complexspaces merged 1 commit intomasterfrom
apple-image-creation-failures
Sep 12, 2025
Merged

Return a conversion failure error when CGImageCreate fails#205
complexspaces merged 1 commit intomasterfrom
apple-image-creation-failures

Conversation

@complexspaces
Copy link
Copy Markdown
Member

@complexspaces complexspaces commented Sep 12, 2025

This PR makes an error handling change to set_image on macOS, which calls into image_from_pixels to create a native image object from the supplied bytes. Previously if the image data wasn't valid for some reason, the call would panic. This isn't ideal as the error message is bad and could happen in the wild (even if these cases are more likely to be programmer errors).

With these changes, those are now converted into Error::ConversionFailure and gracefully returned. Given that this is the only place this error variant can be returned on the set_image codepath, it should still be easy to track down the root cause when/if needed.

Closes #204

@complexspaces complexspaces force-pushed the apple-image-creation-failures branch from 406f259 to 9ee48bf Compare September 12, 2025 07:28
@complexspaces complexspaces force-pushed the apple-image-creation-failures branch from 9ee48bf to 375c7d0 Compare September 12, 2025 07:29
@complexspaces complexspaces merged commit 223f4ef into master Sep 12, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CGImageCreate returns null on macOS 15.6.1

1 participant