diff --git a/lib/serializer/Connection.cpp b/lib/serializer/Connection.cpp index d8521f0a1..f76b77262 100644 --- a/lib/serializer/Connection.cpp +++ b/lib/serializer/Connection.cpp @@ -94,7 +94,13 @@ CPack * CConnection::retrievePack(const std::vector & data) *deserializer & result; - logNetwork->trace("Received CPack of type %s", (result ? typeid(*result).name() : "nullptr")); + if (result == nullptr) + throw std::runtime_error("Failed to retrieve pack!"); + + if (packReader->position != data.size()) + throw std::runtime_error("Failed to retrieve pack! Not all data has been read!"); + + logNetwork->trace("Received CPack of type %s", typeid(*result).name()); return result; }