瀏覽代碼

Fix crash in sntp.sync() (#3460)

Lukáš Voborský 2 年之前
父節點
當前提交
3e97667ff4
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      app/modules/sntp.c

+ 1 - 1
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));