Kaynağa Gözat

Null check for _savecallback (#49)

Paul Andrews 6 yıl önce
ebeveyn
işleme
00b5c15aca
2 değiştirilmiş dosya ile 8 ekleme ve 3 silme
  1. 7 2
      ESPAsyncWiFiManager.cpp
  2. 1 1
      library.json

+ 7 - 2
ESPAsyncWiFiManager.cpp

@@ -371,8 +371,10 @@ void AsyncWiFiManager::startConfigPortalModeless(char const *apName, char const
     DEBUG_WM(WiFi.localIP());
     //connected
     // call the callback!
-    _savecallback();
-
+	if ( _savecallback != NULL) {
+	  //todo: check if any custom parameters actually exist, and check if they really changed maybe
+	  _savecallback();
+	}
   }
 
 
@@ -759,6 +761,8 @@ void AsyncWiFiManager::handleWifi(AsyncWebServerRequest *request,boolean scan) {
   shouldscan=true;
   scannow= -1 ;
 
+  DEBUG_WM(F("Handle wifi"));
+
   String page = FPSTR(WFM_HTTP_HEAD);
   page.replace("{v}", "Config ESP");
   page += FPSTR(HTTP_SCRIPT);
@@ -1059,6 +1063,7 @@ request->send ( 204, "text/plain", "");
 }*/
 
 void AsyncWiFiManager::handleNotFound(AsyncWebServerRequest *request) {
+  DEBUG_WM(F("Handle not found"));
   if (captivePortal(request)) { // If captive portal redirect instead of displaying the error page.
     return;
   }

+ 1 - 1
library.json

@@ -1,5 +1,5 @@
 {
-  "name": "ESPAsyncWifiManager",
+  "name": "ESPAsyncWiFiManager",
   "keywords": "wifi, wi-fi",
   "description": "ESP8266 Async WiFi Connection manager with fallback web configuration portal",
   "repository":