Skip to content

Commit

Permalink
FIxing Object reference is not set to null exception from April 7 th …
Browse files Browse the repository at this point in the history
…hockey app crash analysis.
  • Loading branch information
VaijanathB committed Apr 8, 2016
1 parent 3a01b1f commit 218855f
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>

private async void DrawPath(BasicGeoposition basicGeoposition)
{
if (!ViewModel.IsRecording || ViewModel.CurrentTrip.Points.Count == 0)
if (!ViewModel.IsRecording || ViewModel.CurrentTrip?.Points?.Count == 0)
return;

await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
Expand All @@ -393,8 +393,12 @@ await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
Locations =
new List<BasicGeoposition>(
ViewModel.CurrentTrip.Points.Select(
ViewModel.CurrentTrip?.Points?.Select(
s => new BasicGeoposition() { Latitude = s.Latitude, Longitude = s.Longitude }));

// If the viewmodel still has not added this point, then add it locally to the Locations collection.
if (Locations.Count == 0)
Locations.Add(basicGeoposition);
}
else
Locations.Add(basicGeoposition);
Expand Down

0 comments on commit 218855f

Please sign in to comment.