Skip to content

Commit

Permalink
udp_connection: check if entry is valid first
Browse files Browse the repository at this point in the history
  • Loading branch information
julianoes committed Feb 19, 2019
1 parent ea81a2f commit 135ee9a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/udp_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ bool UdpConnection::send_message(const mavlink_message_t &message)
// on the matching link.
const mavlink_msg_entry_t *entry = mavlink_get_msg_entry(message.msgid);
const uint8_t target_system_id =
reinterpret_cast<const uint8_t *>(message.payload64)[entry->target_system_ofs];
(entry ? reinterpret_cast<const uint8_t *>(message.payload64)[entry->target_system_ofs] :
0);

bool send_successful = true;
for (auto &remote : _remotes) {
Expand Down

0 comments on commit 135ee9a

Please sign in to comment.