From 60eff54d7a5f60abfb7f380fbd302b30dfc4150d Mon Sep 17 00:00:00 2001 From: M Hightower <27247790+mhightower83@users.noreply.github.com> Date: Fri, 17 Apr 2020 11:34:18 -0700 Subject: [PATCH] Null pointer call from WiFiClient::localIP() to IPAddress Fixes exception 28 in IPAddress(const ipv4_addr* fw_addr); with null ip_addr pointer passed in by WiFiCient.cpp localIP(). I assumed that localIP() was called shortly after _pcb became null. --- libraries/ESP8266WiFi/src/WiFiClient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/ESP8266WiFi/src/WiFiClient.cpp b/libraries/ESP8266WiFi/src/WiFiClient.cpp index 059c6c6635..abd277229f 100644 --- a/libraries/ESP8266WiFi/src/WiFiClient.cpp +++ b/libraries/ESP8266WiFi/src/WiFiClient.cpp @@ -367,7 +367,7 @@ uint16_t WiFiClient::remotePort() IPAddress WiFiClient::localIP() { - if (!_client) + if (!_client || !_client->getLocalAddress()) return IPAddress(0U); return IPAddress(_client->getLocalAddress()); @@ -389,7 +389,7 @@ void WiFiClient::stopAll() } -void WiFiClient::stopAllExcept(WiFiClient* except) +void WiFiClient::stopAllExcept(WiFiClient* except) { for (WiFiClient* it = _s_first; it; it = it->_next) { if (it != except) {