diff --git a/src/SFML/Network/Packet.cpp b/src/SFML/Network/Packet.cpp index e639c049a..210a7f6b2 100644 --- a/src/SFML/Network/Packet.cpp +++ b/src/SFML/Network/Packet.cpp @@ -33,6 +33,7 @@ #include +#include #include #include @@ -255,6 +256,8 @@ Packet& Packet::operator>>(double& data) //////////////////////////////////////////////////////////// Packet& Packet::operator>>(char* data) { + assert(data && "Packet::operator>> Data must not be null"); + // First extract string length std::uint32_t length = 0; *this >> length; @@ -297,6 +300,8 @@ Packet& Packet::operator>>(std::string& data) //////////////////////////////////////////////////////////// Packet& Packet::operator>>(wchar_t* data) { + assert(data && "Packet::operator>> Data must not be null"); + // First extract string length std::uint32_t length = 0; *this >> length; @@ -482,6 +487,8 @@ Packet& Packet::operator<<(double data) //////////////////////////////////////////////////////////// Packet& Packet::operator<<(const char* data) { + assert(data && "Packet::operator<< Data must not be null"); + // First insert string length const auto length = static_cast(std::strlen(data)); *this << length; @@ -511,6 +518,8 @@ Packet& Packet::operator<<(const std::string& data) //////////////////////////////////////////////////////////// Packet& Packet::operator<<(const wchar_t* data) { + assert(data && "Packet::operator<< Data must not be null"); + // First insert string length const auto length = static_cast(std::wcslen(data)); *this << length; diff --git a/src/SFML/Window/Context.cpp b/src/SFML/Window/Context.cpp index ce41074ac..b3cd546ca 100644 --- a/src/SFML/Window/Context.cpp +++ b/src/SFML/Window/Context.cpp @@ -33,6 +33,8 @@ #include #include +#include + namespace { @@ -135,6 +137,7 @@ bool Context::isExtensionAvailable(std::string_view name) //////////////////////////////////////////////////////////// GlFunctionPointer Context::getFunction(const char* name) { + assert(name && "Context::getFunction Name must not be null"); return priv::GlContext::getFunction(name); }