From 1fc4e9530de818fd49fc52da7e6555e757dab15f Mon Sep 17 00:00:00 2001 From: softsimon Date: Mon, 26 Oct 2020 19:33:20 +0700 Subject: [PATCH] Handle weird response body when fetching Bisq price. fixes #145 --- backend/src/api/bisq/bisq.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/api/bisq/bisq.ts b/backend/src/api/bisq/bisq.ts index db1bd7746..312837dbd 100644 --- a/backend/src/api/bisq/bisq.ts +++ b/backend/src/api/bisq/bisq.ts @@ -139,7 +139,7 @@ class Bisq { private updatePrice() { request('https://markets.bisq.network/api/trades/?market=bsq_btc', { json: true }, (err, res, trades: BisqTrade[]) => { - if (err) { return logger.err('Error updating Bisq market price: ' + err); } + if (err || !Array.isArray(trades)) { return logger.err('Error updating Bisq market price: ' + err); } const prices: number[] = []; trades.forEach((trade) => {