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

Added product and purchase null checks #58

Merged
merged 1 commit into from
Feb 7, 2023

Conversation

britzl
Copy link
Collaborator

@britzl britzl commented Feb 6, 2023

Added extra null checks when receiving products and purchases.

Fixes #47
Fixes #34

@britzl britzl requested a review from AGulev February 6, 2023 14:59
Copy link
Contributor

@AGulev AGulev left a comment

Choose a reason for hiding this comment

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

LGTM
but it feels strange they may have null everywhere

@britzl
Copy link
Collaborator Author

britzl commented Feb 7, 2023

it feels strange they may have null everywhere

I agree. But we saw that productDetailsList.get(0) could return null. And it is possible to have a null element in a java.util.List so we might as well assume that this can happen throughout the code. I do not like defensive programming but if we can't trust that there is data where there is supposed to be data then it's better to check for it.

@britzl britzl merged commit 649a8a1 into master Feb 7, 2023
@britzl britzl deleted the Issue-47-index-out-of-bounds-exception branch February 7, 2023 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants