Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ResourceID validation check expression #5447

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hyuns66
Copy link

@hyuns66 hyuns66 commented Sep 9, 2024

Description

related issue : #5404
I changed three methods which have wrong expression

  • getFallbackDrawable()
  • getErrorDrawable()
  • getPlaceholderDrawable()
    Resource IDs can be negative, but the functions were treating such IDs as invalid. Therefore, I improved the if statement logic to allow valid resource IDs that have negative values to pass through.

Motivation and Context

According to the referenced documentation, resource IDs can be negative, and while some legacy code assumes -1 to be an invalid resource ID, this is incorrect. The issue #5404 involves a method malfunctioning when using an image with a specific negative value as its resource ID, which was identified as a validation issue related to resourceID. The original code incorrectly assumed any negative value to be an invalid resource ID. However, I have refactored it using the correct validation logic as outlined in the android.content.res package.

Copy link

google-cla bot commented Sep 9, 2024

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.

@hyuns66 hyuns66 force-pushed the master branch 2 times, most recently from 61ab072 to 5f23a12 Compare September 27, 2024 11:14
@kanelbulle kanelbulle enabled auto-merge (rebase) October 2, 2024 02:32
Previously, the existence of a resourceId was determined based on
whether it was a positive number. However, since resourceId can also be
negative, I improved this by checking the flag in the `fileds` variable
to determine whether resourceId exists.
auto-merge was automatically disabled October 3, 2024 08:24

Head branch was pushed to by a user without write access

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.

3 participants