Skip to content

Commit b666435

Browse files
d-a-vdevyte
authored andcommitted
WiFiClient::remoteIP: fix nullptr crash (#5634)
1 parent 324eb56 commit b666435

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: libraries/ESP8266WiFi/src/WiFiClient.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,10 @@ WiFiClient::operator bool()
351351

352352
IPAddress WiFiClient::remoteIP()
353353
{
354-
if (!_client)
354+
if (!_client || !_client->getRemoteAddress())
355355
return IPAddress(0U);
356356

357-
return IPAddress(_client->getRemoteAddress());
357+
return _client->getRemoteAddress();
358358
}
359359

360360
uint16_t WiFiClient::remotePort()

0 commit comments

Comments
 (0)