Skip to content

Commit 671669f

Browse files
Validate ssid to contain a valid string before begin
1 parent 2a012ff commit 671669f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/WiFiConnectionHandler.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ NetworkConnectionState WiFiConnectionHandler::update_handleInit()
9595

9696
if (WiFi.status() != WL_CONNECTED)
9797
{
98+
if (strlen(_settings.wifi.ssid) == 0) {
99+
DEBUG_WARNING("Provided empty ssid, please provide a valid one");
100+
_flags.settings_provided = false;
101+
102+
return NetworkConnectionState::INIT;
103+
}
104+
98105
WiFi.begin(_settings.wifi.ssid, _settings.wifi.pwd);
99106
#if defined(ARDUINO_ARCH_ESP8266)
100107
/* Wait connection otherwise board won't connect */

0 commit comments

Comments
 (0)