Skip to content

Commit

Permalink
AP_Terrain: prevent use of invalid Location
Browse files Browse the repository at this point in the history
loc is not initialised and can cause a fault on startup
  • Loading branch information
tridge committed Dec 22, 2016
1 parent b845668 commit bbccdce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libraries/AP_Terrain/AP_Terrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ void AP_Terrain::update(void)
// update the cached current location height
Location loc;
bool pos_valid = ahrs.get_position(loc);
bool terrain_valid = height_amsl(loc, height, false);
bool terrain_valid = pos_valid && height_amsl(loc, height, false);
if (pos_valid && terrain_valid) {
last_current_loc_height = height;
have_current_loc_height = true;
Expand Down

0 comments on commit bbccdce

Please sign in to comment.