From 5e89578403a86fd09d251e33635251cbe050622c Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Fri, 6 Jan 2023 19:03:07 +0100 Subject: [PATCH] Extend fix #17619 to non-IPv6 (#17621) --- tasmota/tasmota_support/support_wifi.ino | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tasmota/tasmota_support/support_wifi.ino b/tasmota/tasmota_support/support_wifi.ino index fe2b63cf2..fe5b8fb0e 100644 --- a/tasmota/tasmota_support/support_wifi.ino +++ b/tasmota/tasmota_support/support_wifi.ino @@ -756,7 +756,6 @@ String IPForUrl(const IPAddress & ip) // IPv4 has always priority // Copy the value of the IP if pointer provided (optional) bool WifiGetIP(IPAddress *ip) { -#ifdef USE_IPV6 if ((uint32_t)WiFi.localIP() != 0) { if (ip != nullptr) { *ip = WiFi.localIP(); } return true; @@ -765,18 +764,15 @@ bool WifiGetIP(IPAddress *ip) { if (ip != nullptr) { *ip = WiFi.softAPIP(); } return true; } +#ifdef USE_IPV6 IPAddress lip; if (WifiGetIPv6(&lip)) { if (ip != nullptr) { *ip = lip; } return true; } if (ip != nullptr) { *ip = IPAddress(); } - return false; -#else - // IPv4 only - if (ip != nullptr) { *ip = WiFi.localIP(); } - return (uint32_t)WiFi.localIP() != 0; #endif // USE_IPV6 + return false; } bool WifiHasIP(void) {