diff --git a/src/AsyncWebSocket.cpp b/src/AsyncWebSocket.cpp index 9deb74a..aeb3747 100644 --- a/src/AsyncWebSocket.cpp +++ b/src/AsyncWebSocket.cpp @@ -595,7 +595,7 @@ void AsyncWebSocketClient::_onData(void* pbuf, size_t plen) { } // restore byte as _handleEvent may have added a null terminator i.e., data[len] = 0; - if (datalen) + if (data && datalen > 0) data[datalen] = datalast; data += datalen;