From c72d6083ef89f77951550209c5212a705dd4601f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Voborsk=C3=BD?= Date: Fri, 27 Aug 2021 12:09:43 +0200 Subject: [PATCH] Fix crash in sntp.sync() (#3460) --- app/modules/sntp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/modules/sntp.c b/app/modules/sntp.c index 700b9866..3fdfb66b 100644 --- a/app/modules/sntp.c +++ b/app/modules/sntp.c @@ -806,7 +806,7 @@ static int sntp_sync (lua_State *L) } else if (server_count == 0) { lua_newtable(L); struct netif *iface = (struct netif *)eagle_lwip_getif(0x00); - if (iface->dhcp && iface->dhcp->offered_ntp_addr.addr) { + if (iface && iface->dhcp && iface->dhcp->offered_ntp_addr.addr) { ip_addr_t ntp_addr = iface->dhcp->offered_ntp_addr; lua_pushinteger(L, 1); lua_pushstring(L, inet_ntoa(ntp_addr));