From 2f76a9f5b6bedd60198074ebcd69fe36c41d4cba Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Tue, 24 Jul 2018 21:09:37 +0200 Subject: [PATCH] fix case where connection is already freed --- src/AsyncTCP.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/AsyncTCP.cpp b/src/AsyncTCP.cpp index 70ef839..ebeb875 100644 --- a/src/AsyncTCP.cpp +++ b/src/AsyncTCP.cpp @@ -601,10 +601,12 @@ int8_t AsyncClient::abort(){ } void AsyncClient::close(bool now){ - if(_in_lwip_thread){ - tcp_recved(_pcb, _rx_ack_len); - } else { - _tcp_recved(_pcb, _rx_ack_len); + if(_pcb){ + if(_in_lwip_thread){ + tcp_recved(_pcb, _rx_ack_len); + } else { + _tcp_recved(_pcb, _rx_ack_len); + } } if(now) _close();