diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index fe9ae8b3fc..1483fcf610 100755 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2891,7 +2891,7 @@ void* Application::networkReceive(void* args) { app->_packetCount++; app->_bytesCount += bytesReceived; - if (app->_incomingPacket[1] == versionForPacketType(app->_incomingPacket[0])) { + if (packetVersionMatch(app->_incomingPacket)) { // only process this packet if we have a match on the packet version switch (app->_incomingPacket[0]) { case PACKET_TYPE_TRANSMITTER_DATA_V2: diff --git a/libraries/shared/src/PacketHeaders.cpp b/libraries/shared/src/PacketHeaders.cpp index 7188ea8179..9f8314e0b7 100644 --- a/libraries/shared/src/PacketHeaders.cpp +++ b/libraries/shared/src/PacketHeaders.cpp @@ -6,6 +6,8 @@ // Copyright (c) 2013 HighFidelity, Inc. All rights reserved. // +#include + #include "PacketHeaders.h" PACKET_VERSION versionForPacketType(PACKET_TYPE type) { @@ -19,7 +21,12 @@ PACKET_VERSION versionForPacketType(PACKET_TYPE type) { bool packetVersionMatch(unsigned char* packetHeader) { // currently this just checks if the version in the packet matches our return from versionForPacketType // may need to be expanded in the future for types and versions that take > than 1 byte - return packetHeader[1] == versionForPacketType(packetHeader[0]); + if (packetHeader[1] == versionForPacketType(packetHeader[0])) { + return true; + } else { + printf("There is a packet version mismatch for packet with header %c\n", packetHeader[0]); + return false; + } } int populateTypeAndVersion(unsigned char* destinationHeader, PACKET_TYPE type) {