Improving readIP function

Change logic to first check if JsonVariant is a String.
This commit is contained in:
Mauro De Lucca 2019-04-26 23:07:40 -04:00
parent 348e65ba4b
commit b75cee0b30

View File

@ -77,7 +77,7 @@ void WiFiSettingsService::reconfigureWiFiConnection() {
} }
void WiFiSettingsService::readIP(JsonObject& root, String key, IPAddress& _ip){ void WiFiSettingsService::readIP(JsonObject& root, String key, IPAddress& _ip){
if ( root[key].isNull() || !_ip.fromString(root[key].as<String>())){ if ( !root[key].is<String>() || !_ip.fromString(root[key].as<String>())){
_ip = INADDR_NONE; _ip = INADDR_NONE;
} }
} }