From 1a6b8ffd6b13e8eb84bff839bd6c7e9466e9cb3d Mon Sep 17 00:00:00 2001 From: downthecrop Date: Sun, 4 Jun 2023 11:20:20 +0900 Subject: [PATCH] Log error and continue when malformed minAmount in JSON (#219) --- services/m=data/searchtool.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/m=data/searchtool.js b/services/m=data/searchtool.js index 4acd429d3..2edd06843 100644 --- a/services/m=data/searchtool.js +++ b/services/m=data/searchtool.js @@ -231,6 +231,10 @@ export default { } getExpectedQuantity() { let t = 0; + if(this.minAmount > this.maxAmount ) { + console.error("ERROR WITH DROP ID", this.id, "- MinValue > MaxValue") + return(0) + } const range = Array(this.maxAmount - this.minAmount + 1).fill(1).map((x, y) => this.minAmount + y); return ((range.reduce((a, b) => a + b, t) / range.length * (this.rarity / 100))).toFixed(2) }