fix bug associated with dangling pointer

This commit is contained in:
rjwats@gmail.com 2018-03-06 22:36:55 +00:00
parent 0b334a8ade
commit beb3ff9a62

View File

@ -40,7 +40,10 @@ void OTASettingsService::writeToJsonObject(JsonObject& root) {
}
void OTASettingsService::configureArduinoOTA() {
delete _arduinoOTA;
if (_arduinoOTA){
delete _arduinoOTA;
_arduinoOTA = NULL;
}
if (_enabled) {
_arduinoOTA = new ArduinoOTAClass;
_arduinoOTA->setPort(_port);