diff --git a/generator/C/include_v2.0/mavlink_helpers.h b/generator/C/include_v2.0/mavlink_helpers.h index d5672d241..d356d99eb 100644 --- a/generator/C/include_v2.0/mavlink_helpers.h +++ b/generator/C/include_v2.0/mavlink_helpers.h @@ -495,7 +495,7 @@ MAVLINK_HELPER const mavlink_msg_entry_t *mavlink_get_msg_entry(uint32_t msgid) use a bisection search to find the right entry. A perfect hash may be better Note that this assumes the table is sorted by msgid */ - uint32_t low=0, high=sizeof(mavlink_message_crcs)/sizeof(mavlink_message_crcs[0]); + uint32_t low=0, high=sizeof(mavlink_message_crcs)/sizeof(mavlink_message_crcs[0]) - 1; while (low < high) { uint32_t mid = (low+1+high)/2; if (msgid < mavlink_message_crcs[mid].msgid) {