Skip to content

Commit 8606733

Browse files
SteveToulouseigrr
authored andcommitted
Fix2115 (#2244)
* Update ESP8266WiFiMulti.cpp Fix #2115 * Update ESP8266WiFiMulti.cpp Fix #2115. Cleaner version (catch strdup("") fail).
1 parent f8a8a2a commit 8606733

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

libraries/ESP8266WiFi/src/ESP8266WiFiMulti.cpp

+9-6
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,16 @@ bool ESP8266WiFiMulti::APlistAdd(const char* ssid, const char *passphrase) {
184184
return false;
185185
}
186186

187-
if(passphrase && *passphrase != 0x00) {
187+
if(passphrase) {
188188
newAP.passphrase = strdup(passphrase);
189-
if(!newAP.passphrase) {
190-
DEBUG_WIFI_MULTI("[WIFI][APlistAdd] fail newAP.passphrase == 0\n");
191-
free(newAP.ssid);
192-
return false;
193-
}
189+
} else {
190+
newAP.passphrase = strdup("");
191+
}
192+
193+
if(!newAP.passphrase) {
194+
DEBUG_WIFI_MULTI("[WIFI][APlistAdd] fail newAP.passphrase == 0\n");
195+
free(newAP.ssid);
196+
return false;
194197
}
195198

196199
APlist.push_back(newAP);

0 commit comments

Comments
 (0)