Skip to content

Fix NPE in DrawableTransformation when custom transform returns null#5654

Open
jayyaj12 wants to merge 6 commits intobumptech:masterfrom
jayyaj12:fix/issue-5651-drawable-transformation
Open

Fix NPE in DrawableTransformation when custom transform returns null#5654
jayyaj12 wants to merge 6 commits intobumptech:masterfrom
jayyaj12:fix/issue-5651-drawable-transformation

Conversation

@jayyaj12
Copy link
Copy Markdown

@jayyaj12 jayyaj12 commented Jan 9, 2026

Description

This PR inverts the equality check in DrawableTransformation's transform method.
Instead of calling .equals() on the potentially null transformedBitmapResource, it now calls it on bitmapResourceToTransform, which is guaranteed to be non-null by the preceding null check.

Motivation and Context

If a custom Transformation implementation returns null, the current implementation throws a NullPointerException when attempting to check for equality.
By swapping the order of comparison to original.equals(transformed), we prevent this crash. This change also aligns the behavior with BitmapTransformation.

Fixes #5651

@google-cla
Copy link
Copy Markdown

google-cla bot commented Jan 9, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@jayyaj12
Copy link
Copy Markdown
Author

Branch updated and all checks passing. Ready for review when you have time. Thanks!

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.

Crash on DrawableTransformation if the custom transform returns null

1 participant