kopia lustrzana https://github.com/micropython/micropython
esp8266/modnetwork: Return empty str for hostname if STA is inactive.
Instead of crashing due to NULL pointer dereference. Fixes issue #3341.pull/3791/head
rodzic
94a79f340d
commit
f8a5cd24d8
|
@ -443,7 +443,11 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
|
|||
case MP_QSTR_dhcp_hostname: {
|
||||
req_if = STATION_IF;
|
||||
char* s = wifi_station_get_hostname();
|
||||
val = mp_obj_new_str(s, strlen(s));
|
||||
if (s == NULL) {
|
||||
val = MP_OBJ_NEW_QSTR(MP_QSTR_);
|
||||
} else {
|
||||
val = mp_obj_new_str(s, strlen(s));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
Ładowanie…
Reference in New Issue