AP_Common: Location.cpp: add sanity checks

This commit is contained in:
Peter Barker 2018-07-26 11:40:05 +10:00 committed by Randy Mackay
parent 6031f5b6a9
commit ab7ee4fefb
1 changed files with 5 additions and 0 deletions

View File

@ -102,6 +102,11 @@ Location::AltFrame Location::get_alt_frame() const
/// get altitude in desired frame /// get altitude in desired frame
bool Location::get_alt_cm(AltFrame desired_frame, int32_t &ret_alt_cm) const bool Location::get_alt_cm(AltFrame desired_frame, int32_t &ret_alt_cm) const
{ {
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
if (lat == 0 && lng == 0) {
AP_HAL::panic("Should not be called on invalid location");
}
#endif
Location::AltFrame frame = get_alt_frame(); Location::AltFrame frame = get_alt_frame();
// shortcut if desired and underlying frame are the same // shortcut if desired and underlying frame are the same