From 14f9dc2c050753467c8f601b173a49c1fb159f7e Mon Sep 17 00:00:00 2001 From: likho Date: Tue, 6 Jun 2023 16:34:43 +0200 Subject: [PATCH] Handle price_change_percentage_24h being null and not able to parse as double --- lib/services/price.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/services/price.dart b/lib/services/price.dart index 16bd93c6a..a57b34364 100644 --- a/lib/services/price.dart +++ b/lib/services/price.dart @@ -105,8 +105,8 @@ class PriceAPI { final coin = coinFromPrettyName(coinName); final price = Decimal.parse(map["current_price"].toString()); - final change24h = - double.parse(map["price_change_percentage_24h"].toString()); + final change24h = map["price_change_percentage_24h"] != null ? + double.parse(map["price_change_percentage_24h"].toString()) : 0.0; result[coin] = Tuple2(price, change24h); }