Skip to content

Commit

Permalink
Prevent NullPointerException if user deletes the quote in the transac…
Browse files Browse the repository at this point in the history
…tion dialog
  • Loading branch information
buchen committed Mar 1, 2024
1 parent 4a2390a commit b618f02
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -394,12 +394,15 @@ public BigDecimal getQuote()

public void setQuote(BigDecimal quote)
{
firePropertyChange(Properties.quote.name(), this.quote, this.quote = quote);
var newValue = quote == null ? BigDecimal.ZERO : quote;

triggerGrossValue(Math.round(shares * quote.doubleValue() * Values.Amount.factor() / Values.Share.divider()));
firePropertyChange(Properties.quote.name(), this.quote, this.quote = newValue); // NOSONAR

triggerGrossValue(
Math.round(shares * newValue.doubleValue() * Values.Amount.factor() / Values.Share.divider()));

firePropertyChange(Properties.calculationStatus.name(), this.calculationStatus,
this.calculationStatus = calculateStatus());
this.calculationStatus = calculateStatus()); // NOSONAR
}

public long getGrossValue()
Expand Down

0 comments on commit b618f02

Please sign in to comment.