Skip to content

Commit e1337aa

Browse files
committed
Add check
1 parent b9090e7 commit e1337aa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libraries/WiFi/src/WiFiGeneric.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,11 @@ int32_t WiFiGenericClass::channel(void)
12771277
void WiFiGenericClass::channel(uint8_t primary, wifi_second_chan_t secondary)
12781278
{
12791279
wifi_country_t country;
1280-
esp_wifi_get_country(&country);
1280+
1281+
if (esp_wifi_get_country(&country) != ESP_OK) {
1282+
log_e("Failed to get country info");
1283+
return;
1284+
}
12811285

12821286
uint8_t min_chan = country.schan;
12831287
uint8_t max_chan = min_chan + country.nchan - 1;

0 commit comments

Comments
 (0)