Skip to content

Commit

Permalink
fix #728 dropNativeClient null ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
Links2004 committed Apr 5, 2022
1 parent ab9af16 commit 28c0cf3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/WebSocketsClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,9 +786,9 @@ void WebSocketsClient::handleHeader(WSclient_t * client, String * headerLine) {
}
// falls through
case 403: ///< Forbidden
// todo handle login
// falls through
default: ///< Server dont unterstand requrst
// todo handle login
// falls through
default: ///< Server dont unterstand requrst
ok = false;
DEBUG_WEBSOCKETS("[WS-Client][handleHeader] serverCode is not 101 (%d)\n", client->cCode);
clientDisconnect(client);
Expand Down
3 changes: 3 additions & 0 deletions src/WebSocketsServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,9 @@ void WebSocketsServerCore::messageReceived(WSclient_t * client, WSopcode_t opcod
* @param client WSclient_t * ptr to the client struct contaning the native client "->tcp"
*/
void WebSocketsServerCore::dropNativeClient(WSclient_t * client) {
if(!client) {
return;
}
if(client->tcp) {
if(client->tcp->connected()) {
#if(WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP8266_ASYNC) && (WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP32)
Expand Down

0 comments on commit 28c0cf3

Please # to comment.