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 NPE in ProductListAdapter #4469

Merged
merged 1 commit into from
Feb 8, 2022
Merged

Fix NPE in ProductListAdapter #4469

merged 1 commit into from
Feb 8, 2022

Conversation

R4md4c
Copy link
Contributor

@R4md4c R4md4c commented Feb 8, 2022

Description

This NPE can be reproduced by adding the product that was mentioned in here to a list, the crash happens once you click on that products list.

For the fix, I made the ListedProduct more null-safe by marking imageUrl as nullable, then handling the nullability inside the adapter to prevent the NPE.

Related issues

Fixes #4345

@sonarcloud
Copy link

sonarcloud bot commented Feb 8, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@VaiTon VaiTon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@VaiTon VaiTon merged commit 3af2973 into openfoodfacts:develop Feb 8, 2022
@R4md4c R4md4c deleted the npe-fix-#4345 branch February 8, 2022 22:57
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.

NPE - products[position].imageUrl must not be null (ProductListAdapter.kt:40)
2 participants