From fcd2bcd34f977140bcc1290a2ec86a0ffbcc18eb Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Sat, 26 Feb 2022 15:13:21 -0300 Subject: [PATCH] Allow editoffer clients to pass empty string for price parameter 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. --- core/src/main/java/bisq/core/api/EditOfferValidator.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/bisq/core/api/EditOfferValidator.java b/core/src/main/java/bisq/core/api/EditOfferValidator.java index 977b7a738e7..f3b90e7f1eb 100644 --- a/core/src/main/java/bisq/core/api/EditOfferValidator.java +++ b/core/src/main/java/bisq/core/api/EditOfferValidator.java @@ -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.