diff --git a/MarketPriceLookup.Common/Helpers/MarketPricesHelper.cs b/MarketPriceLookup.Common/Helpers/MarketPricesHelper.cs index f03ca1d..6136c58 100644 --- a/MarketPriceLookup.Common/Helpers/MarketPricesHelper.cs +++ b/MarketPriceLookup.Common/Helpers/MarketPricesHelper.cs @@ -44,7 +44,7 @@ namespace MarketPriceLookup.Common.Helpers // iterate over all items returned and filter out bad prices foreach (var item in parsedResponse.data.items) { - if (item.historicalPrices.Length == 0) + if (item.historicalPrices == null || item.historicalPrices.Length == 0) { LoggingHelpers.LogError($"unable to add item {item.id} {item.name} with no historical prices, ignoring"); continue; @@ -88,7 +88,7 @@ namespace MarketPriceLookup.Common.Helpers { Name = item.name, //Price = price, - Average24hPrice = item.avg24hPrice, + Average24hPrice = item.avg24hPrice ?? 0, Average7DaysPrice = averagedItemPrice, PricePoints = item.historicalPrices.Length, //Trader = trader, diff --git a/MarketPriceLookup.Common/Helpers/TarkovDevResponse.cs b/MarketPriceLookup.Common/Helpers/TarkovDevResponse.cs index a74a760..02a9a87 100644 --- a/MarketPriceLookup.Common/Helpers/TarkovDevResponse.cs +++ b/MarketPriceLookup.Common/Helpers/TarkovDevResponse.cs @@ -16,7 +16,7 @@ namespace MarketPriceLookup.Common.Helpers public class Item { public string name { get; set; } - public int avg24hPrice { get; set; } + public int? avg24hPrice { get; set; } public double? changeLast48hPercent { get; set; } public string id { get; set; } public HistoricalPrice[] historicalPrices { get; set; }