diff --git a/libraries/SocketWrapper/Ethernet.h b/libraries/SocketWrapper/Ethernet.h index 989420ab..a3cbcd84 100644 --- a/libraries/SocketWrapper/Ethernet.h +++ b/libraries/SocketWrapper/Ethernet.h @@ -46,9 +46,9 @@ class EthernetClass: public NetworkInterface EthernetHardwareStatus hardwareStatus() { const struct device *const dev = DEVICE_DT_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(ethernet_phy)); if (device_is_ready(dev)) { - for (int i = 1; i < 3; i++) { + for (int i = 1; i < 4; i++) { auto _if = net_if_get_by_index(i); - if (!net_eth_type_is_wifi(_if)) { + if (_if && !net_eth_type_is_wifi(_if)) { netif = _if; break; }