Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit 5f648ff

Browse files
author
Paul Sokolovsky
committed
zephyr/main: Check default netif before applying operations to it.
If no network driver is enabled (e.g., it doesn't exist for a particular board), it will be NULL.
1 parent aa9ce28 commit 5f648ff

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

zephyr/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ static char heap[MICROPY_HEAP_SIZE];
6262

6363
void init_zephyr(void) {
6464
// TODO: Make addresses configurable
65+
#ifdef CONFIG_NETWORKING
66+
if (net_if_get_default() == NULL) {
67+
// If there's no default networking interface,
68+
// there's nothing to configure.
69+
return;
70+
}
71+
#endif
6572
#ifdef CONFIG_NET_IPV4
6673
static struct in_addr in4addr_my = {{{192, 0, 2, 1}}};
6774
net_if_ipv4_addr_add(net_if_get_default(), &in4addr_my, NET_ADDR_MANUAL, 0);

0 commit comments

Comments
 (0)