Skip to content

Commit 28c0cf3

Browse files
committed
fix #728 dropNativeClient null ptr
1 parent ab9af16 commit 28c0cf3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/WebSocketsClient.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -786,9 +786,9 @@ void WebSocketsClient::handleHeader(WSclient_t * client, String * headerLine) {
786786
}
787787
// falls through
788788
case 403: ///< Forbidden
789-
// todo handle login
790-
// falls through
791-
default: ///< Server dont unterstand requrst
789+
// todo handle login
790+
// falls through
791+
default: ///< Server dont unterstand requrst
792792
ok = false;
793793
DEBUG_WEBSOCKETS("[WS-Client][handleHeader] serverCode is not 101 (%d)\n", client->cCode);
794794
clientDisconnect(client);

src/WebSocketsServer.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,9 @@ void WebSocketsServerCore::messageReceived(WSclient_t * client, WSopcode_t opcod
516516
* @param client WSclient_t * ptr to the client struct contaning the native client "->tcp"
517517
*/
518518
void WebSocketsServerCore::dropNativeClient(WSclient_t * client) {
519+
if(!client) {
520+
return;
521+
}
519522
if(client->tcp) {
520523
if(client->tcp->connected()) {
521524
#if(WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP8266_ASYNC) && (WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP32)

0 commit comments

Comments
 (0)