diff --git a/libraries/WiFi/src/WiFi.cpp b/libraries/WiFi/src/WiFi.cpp index bb1750fc..8417aaec 100644 --- a/libraries/WiFi/src/WiFi.cpp +++ b/libraries/WiFi/src/WiFi.cpp @@ -168,12 +168,13 @@ void CWifi::end(void) { /* -------------------------------------------------------------------------- */ uint8_t* CWifi::macAddress(uint8_t* mac) { /* -------------------------------------------------------------------------- */ - if(ni != nullptr) { - if(ni->getMacAddress(mac) == WL_MAC_ADDR_LENGTH) { - return mac; - } + if(ni == nullptr) { + ni = CLwipIf::getInstance().get(NI_WIFI_STATION); + } + + if(ni->getMacAddress(mac) != WL_MAC_ADDR_LENGTH) { + memset(mac, 0x00, 6); } - memset(mac,0x00,6); return mac; }