Skip to content

Commit

Permalink
Prevent potential use of uninitialised variables
Browse files Browse the repository at this point in the history
  • Loading branch information
rnorris committed Jan 18, 2025
1 parent 2b23a39 commit 9a5ad12
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/viktrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -2173,6 +2173,14 @@ void vik_track_calculate_bounds ( VikTrack *tr )
if ( tp_iter ) {
vik_coord_to_latlon ( &(VIK_TRACKPOINT(tp_iter->data)->coord), &topleft );
vik_coord_to_latlon ( &(VIK_TRACKPOINT(tp_iter->data)->coord), &bottomright );
} else {
// Defaults when no trackpoints
// values aren't actively used, but avoids potential use of uninitialised variables
// (they are reset when first trkpt set or entire track is set)
topleft.lat = NAN;
topleft.lon = NAN;
bottomright.lat = NAN;
bottomright.lon = NAN;
}
while ( tp_iter ) {

Expand Down

0 comments on commit 9a5ad12

Please sign in to comment.