Skip to content
This repository has been archived by the owner on Sep 14, 2018. It is now read-only.

Commit

Permalink
Fix Nullreference SegmentEfforts other athletes
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlannoeye committed Mar 5, 2016
1 parent 718d16c commit c10b230
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Kliva/Services/StravaActivityService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ public async Task<Activity> GetActivityAsync(string id, bool includeEfforts)

var activity = Unmarshaller<Activity>.Unmarshal(json);
StravaService.SetMetricUnits(activity, defaultDistanceUnitType);
foreach (SegmentEffort segment in activity.SegmentEfforts)
StravaService.SetMetricUnits(segment, defaultDistanceUnitType);
if (activity.SegmentEfforts != null)
{
foreach (SegmentEffort segment in activity.SegmentEfforts)
StravaService.SetMetricUnits(segment, defaultDistanceUnitType);
}

return activity;
}
Expand Down

0 comments on commit c10b230

Please sign in to comment.