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

[BUG] - Null Pinter Reference - cartItems - ProcessPaymentServlet.Java #153

Open
gandhi-samir opened this issue Apr 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@gandhi-samir
Copy link

gandhi-samir commented Apr 8, 2024

Description

In ProcessPaymentServlet.java at line 48, there is the possibility of hitting a null pointer reference. Line 46 has a condition to check != null how ever that condition does not cover the for loop of the cartItem list. The If condition (line 46) needs to cover the entire for loop starting at line 48.

Expected behavior

list does not hit null reference when iterating the loop at checkout

Actual behavior

list hits null reference and an error is thrown.

Possible fix

The If condition (line 46) needs to cover the entire for loop starting at line 48.

Steps to reproduce

In ProcessPaymentServlet.java at line 48, there is the possibility of hitting a null pointer reference. Line 46 has a condition to check != null how ever that condition does not cover the for loop of the cartItem list. The If condition (line 46) needs to cover the entire for loop starting at line 48.

Context

Was doing code review and running find bugs on the code

Additional information

No response

@gandhi-samir gandhi-samir added the bug Something isn't working label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant