Skip to content

Commit f5cf37b

Browse files
committed
fix ethernet iface selection
1 parent e30c16f commit f5cf37b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libraries/SocketWrapper/Ethernet.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ class EthernetClass: public NetworkInterface
4646
EthernetHardwareStatus hardwareStatus() {
4747
const struct device *const dev = DEVICE_DT_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(ethernet_phy));
4848
if (device_is_ready(dev)) {
49-
for (int i = 1; i < 3; i++) {
49+
for (int i = 1; i <= 3; i++) {
5050
auto _if = net_if_get_by_index(i);
51-
if (!net_eth_type_is_wifi(_if)) {
51+
if ((_if != nullptr) && !net_eth_type_is_wifi(_if)) {
5252
netif = _if;
5353
break;
5454
}

0 commit comments

Comments
 (0)