Skip to content

Commit 63da175

Browse files
committed
Fix spurious mission warning
1 parent 977aee9 commit 63da175

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/modules/navigator/mission.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,10 @@ Mission::read_mission_item(bool onboard, bool is_current, struct mission_item_s
656656
for (int i = 0; i < 10; i++) {
657657

658658
if (*mission_index_ptr < 0 || *mission_index_ptr >= (int)mission->count) {
659-
/* mission item index out of bounds */
660-
mavlink_and_console_log_critical(_navigator->get_mavlink_fd(), "[wpm] err: index: %d, max: %d", *mission_index_ptr, (int)mission->count);
659+
/* mission item index out of bounds - if they are equal, we just reached the end */
660+
if (*mission_index_ptr != (int)mission->count) {
661+
mavlink_and_console_log_critical(_navigator->get_mavlink_fd(), "[wpm] err: index: %d, max: %d", *mission_index_ptr, (int)mission->count);
662+
}
661663
return false;
662664
}
663665

0 commit comments

Comments
 (0)