diff --git a/libraries/AC_Fence/AC_Fence.cpp b/libraries/AC_Fence/AC_Fence.cpp index 1a24dd2714..161ee213a7 100644 --- a/libraries/AC_Fence/AC_Fence.cpp +++ b/libraries/AC_Fence/AC_Fence.cpp @@ -550,7 +550,9 @@ bool AC_Fence::load_polygon_from_eeprom(bool force_reload) return false; } struct Location ekf_origin {}; - AP::ahrs().get_origin(ekf_origin); + if (!AP::ahrs().get_origin(ekf_origin)) { + return false; + } // sanity check total _total = constrain_int16(_total, 0, _poly_loader.max_points());