Commit 65a68c62 authored by Gus Grubba's avatar Gus Grubba Committed by Lorenz Meier

Test message info before using it.

parent d930895b
...@@ -60,14 +60,18 @@ void MAVLinkDecoder::receiveMessage(LinkInterface* link,mavlink_message_t messag ...@@ -60,14 +60,18 @@ void MAVLinkDecoder::receiveMessage(LinkInterface* link,mavlink_message_t messag
{ {
Q_UNUSED(link); Q_UNUSED(link);
msgDict[message.msgid] = message;
uint32_t msgid = message.msgid; uint32_t msgid = message.msgid;
const mavlink_message_info_t* msgInfo = mavlink_get_message_info(&message); const mavlink_message_info_t* msgInfo = mavlink_get_message_info(&message);
if(!msgInfo) {
qWarning() << "Invalid MAVLink message received. ID:" << msgid;
return;
}
msgDict[message.msgid] = message;
// Store an arrival time for this message. This value ends up being calculated later. // Store an arrival time for this message. This value ends up being calculated later.
quint64 time = 0; quint64 time = 0;
// The SYSTEM_TIME message is special, in that it's handled here for synchronizing the QGC time with the remote time. // The SYSTEM_TIME message is special, in that it's handled here for synchronizing the QGC time with the remote time.
if (message.msgid == MAVLINK_MSG_ID_SYSTEM_TIME) if (message.msgid == MAVLINK_MSG_ID_SYSTEM_TIME)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment