diff --git a/src/OTASettingsService.cpp b/src/OTASettingsService.cpp index 1003b42..403ca38 100644 --- a/src/OTASettingsService.cpp +++ b/src/OTASettingsService.cpp @@ -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);