Skip to content

Commit

Permalink
Allow editoffer clients to pass empty string for price parameter
Browse files Browse the repository at this point in the history
The client may have passed an empty string for the price parameter,
if only enabling or disabling the offer.  If so, validate with new
price = old price.
  • Loading branch information
ghubstan committed Feb 26, 2022
1 parent ab8a343 commit fcd2bcd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/src/main/java/bisq/core/api/EditOfferValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ class EditOfferValidator {
int newEnable,
EditOfferRequest.EditType editType) {
this.currentlyOpenOffer = currentlyOpenOffer;
this.newPrice = newPrice;
// The client may have passed an empty string for the price parameter
// if only enabling or disabling the offer. If so, validate with new
// price = old price.
this.newPrice = editType.equals(ACTIVATION_STATE_ONLY)
? currentlyOpenOffer.getOffer().getPrice().toString()
: newPrice;
// The client cannot determine what offer.isUseMarketBasedPrice should be
// when editType = ACTIVATION_STATE_ONLY. Override newIsUseMarketBasedPrice
// param for the ACTIVATION_STATE_ONLY case.
Expand Down

0 comments on commit fcd2bcd

Please sign in to comment.