Skip to content

Commit

Permalink
Increased protection against empty tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
rnorris committed Jan 18, 2025
1 parent 736160e commit 935ed77
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/viktrwlayer_propwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,8 @@ static gdouble tp_percentage_by_time ( VikTrack *tr, VikTrackpoint *trackpoint )
gdouble pc = NAN;
if (trackpoint == NULL)
return pc;
if (tr->trackpoints == NULL)
return pc;
gdouble t_start, t_end, t_total;
t_start = VIK_TRACKPOINT(tr->trackpoints->data)->timestamp;
t_end = VIK_TRACKPOINT(g_list_last(tr->trackpoints)->data)->timestamp;
Expand All @@ -511,6 +513,8 @@ static gdouble tp_percentage_by_distance ( VikTrack *tr, VikTrackpoint *trackpoi
gdouble pc = NAN;
if (trackpoint == NULL)
return pc;
if (tr->trackpoints == NULL)
return pc;
// Is it the first trackpoint?
if (trackpoint == tr->trackpoints->data)
return 0.0;
Expand Down

0 comments on commit 935ed77

Please sign in to comment.