LineItem.java #684 hasDiscounts() Returns Null
bryannevega opened this issue · comments
bryanne commented
If the object doesn't have any discounts the line item object doesn't have a "hasDiscounts" boolean field nor the method returns false.
In order to avoid the issue, I use
lineItem.getDiscounts != null
where it could be :
if(lineItem.hasDiscounts){
//Logic
}
Is this the intended behavior or can this be considered into implementation?
Achintha Bandara commented
To use in the if condition, it should return a Boolean value, in your case it does not.
bryanne commented
To use in the if condition, it should return a Boolean value, in your case it does not.
Exactly, it always returns a NPE because the object itself doesn't have a field "hasDiscounts".