summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-05-17 00:17:53 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-05-17 00:17:53 +0300
commit5f648ff60e0e7ff4eaa1add0091962f02256235f (patch)
tree663e414d23b99776e6eb99198ca35246b2cee189
parentaa9ce283c2b1877a73e20dace4062484d3d5f7fa (diff)
downloadmicropython-5f648ff60e0e7ff4eaa1add0091962f02256235f.tar.gz
micropython-5f648ff60e0e7ff4eaa1add0091962f02256235f.zip
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.
-rw-r--r--zephyr/main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/zephyr/main.c b/zephyr/main.c
index a67ad33526..a4301629f4 100644
--- a/zephyr/main.c
+++ b/zephyr/main.c
@@ -62,6 +62,13 @@ static char heap[MICROPY_HEAP_SIZE];
void init_zephyr(void) {
// TODO: Make addresses configurable
+ #ifdef CONFIG_NETWORKING
+ if (net_if_get_default() == NULL) {
+ // If there's no default networking interface,
+ // there's nothing to configure.
+ return;
+ }
+ #endif
#ifdef CONFIG_NET_IPV4
static struct in_addr in4addr_my = {{{192, 0, 2, 1}}};
net_if_ipv4_addr_add(net_if_get_default(), &in4addr_my, NET_ADDR_MANUAL, 0);