Skip to content

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

Description

@gandhi-samir

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions