GCS_MAVLink: fix always 0 division.

7/8 into array range bracket will be integral type, therefore 7/8 is reported as always 0.
This commit is contained in:
Pierre Kancir 2021-08-13 09:28:14 +02:00 committed by Randy Mackay
parent 57aa4ed023
commit fb5ec4899d

View File

@ -230,7 +230,7 @@ MAV_MISSION_RESULT MissionItemProtocol_Fence::allocate_receive_resources(const u
MAV_MISSION_RESULT MissionItemProtocol_Fence::allocate_update_resources() MAV_MISSION_RESULT MissionItemProtocol_Fence::allocate_update_resources()
{ {
const uint16_t _item_count = _fence.polyfence().num_stored_items(); const uint16_t _item_count = _fence.polyfence().num_stored_items();
_updated_mask = new uint8_t[(_item_count+7/8)]; _updated_mask = new uint8_t[(_item_count+7)/8];
if (_updated_mask == nullptr) { if (_updated_mask == nullptr) {
return MAV_MISSION_ERROR; return MAV_MISSION_ERROR;
} }