Closed AlexIII closed 3 years ago
Not to crash? Or if it is intended behavior, maybe it is useful to add a few words in the docs that it's the user's responsibility to check wifi mode is STATION before calling sntp.sync().
STATION
sntp.sync()
A crash
Provide a Minimal, Complete, and Verifiable example which will reproduce the problem.
wifi.setmode(wifi.SOFTAP) wifi.ap.config({ ... }) sntp.sync()
NodeMCU 3.0.0.0 built on nodemcu-build.com provided by frightanic.com branch: release commit: d4ae3c364bd8ae3ded8b77d35745b7f07879f5f9 release: release DTS: 202105102018 SSL: false build type: float LFS: 0x0 bytes total capacity modules: file,gpio,net,node,rtctime,sjson,sntp,tmr,uart,wifi build 2021-07-24 15:53 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)
ESP8266MOD (ESP-12)
Hi, it is a bug that has a simple fix:
- if (iface->dhcp && iface->dhcp->offered_ntp_addr.addr) { + if (iface && iface->dhcp && iface->dhcp->offered_ntp_addr.addr) {
I'll post a PR shortly.
Expected behavior
Not to crash? Or if it is intended behavior, maybe it is useful to add a few words in the docs that it's the user's responsibility to check wifi mode is
STATION
before callingsntp.sync()
.Actual behavior
A crash
Test code
Provide a Minimal, Complete, and Verifiable example which will reproduce the problem.
NodeMCU startup banner
NodeMCU 3.0.0.0 built on nodemcu-build.com provided by frightanic.com branch: release commit: d4ae3c364bd8ae3ded8b77d35745b7f07879f5f9 release: release DTS: 202105102018 SSL: false build type: float LFS: 0x0 bytes total capacity modules: file,gpio,net,node,rtctime,sjson,sntp,tmr,uart,wifi build 2021-07-24 15:53 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)
Hardware
ESP8266MOD (ESP-12)