Merge pull request #3586 from mempool/nymkappa/fix-price-undefined

Add missing sanity check when fetching single price datapoint
This commit is contained in:
softsimon 2023-04-01 18:04:32 +09:00 committed by GitHub
commit 83c03474a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -160,7 +160,7 @@ class PricesRepository {
// Compute fiat exchange rates
let latestPrice = rates[0] as ApiPrice;
if (latestPrice.USD === -1) {
if (!latestPrice || latestPrice.USD === -1) {
latestPrice = priceUpdater.getEmptyPricesObj();
}