From 9a6b7ec31f8f441c3fa6903638a1f922ea276085 Mon Sep 17 00:00:00 2001 From: Alexander Artamonov Date: Mon, 25 Feb 2019 15:55:43 +0300 Subject: [PATCH] BusinessProcessor.GetStatisticsAsync() - fixed possible null value for followers_unit.followers_delta_from_last_week (#194) --- .../ResponseWrappers/Business/InstaStatisticsResponse.cs | 2 +- .../Converters/Business/InstaStatisticsConverter.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/InstagramApiSharp/Classes/ResponseWrappers/Business/InstaStatisticsResponse.cs b/src/InstagramApiSharp/Classes/ResponseWrappers/Business/InstaStatisticsResponse.cs index ceb1c282..dbfa04be 100644 --- a/src/InstagramApiSharp/Classes/ResponseWrappers/Business/InstaStatisticsResponse.cs +++ b/src/InstagramApiSharp/Classes/ResponseWrappers/Business/InstaStatisticsResponse.cs @@ -284,7 +284,7 @@ public class InstaStatisticsFollowersUnitResponse [JsonProperty("followers_unit_state")] public string FollowersUnitState { get; set; } [JsonProperty("followers_delta_from_last_week")] - public int FollowersDeltaFromLastWeek { get; set; } + public int? FollowersDeltaFromLastWeek { get; set; } = 0; [JsonProperty("gender_graph")] public InstaStatisticsDataPointsResponse GenderGraph { get; set; } [JsonProperty("all_followers_age_graph")] diff --git a/src/InstagramApiSharp/Converters/Business/InstaStatisticsConverter.cs b/src/InstagramApiSharp/Converters/Business/InstaStatisticsConverter.cs index f293925e..859203cf 100644 --- a/src/InstagramApiSharp/Converters/Business/InstaStatisticsConverter.cs +++ b/src/InstagramApiSharp/Converters/Business/InstaStatisticsConverter.cs @@ -123,7 +123,7 @@ public InstaStatistics Convert() statisfics.BusinessManager.FollowersUnit = new InstaStatisticsFollowersUnit { FollowersUnitState = businessManager.FollowersUnit.FollowersUnitState, - FollowersDeltaFromLastWeek = businessManager.FollowersUnit.FollowersDeltaFromLastWeek + FollowersDeltaFromLastWeek = businessManager.FollowersUnit.FollowersDeltaFromLastWeek ?? default(int) }; foreach (var dataPoint in businessManager.FollowersUnit.AllFollowersAgeGraph.DataPoints) {