From fc84e7a2607b0d35c750ce1b7983238d2e4bf87e Mon Sep 17 00:00:00 2001 From: tablatronix Date: Fri, 13 Jul 2018 23:52:36 -0500 Subject: [PATCH] trying to fix param issues when param is out of scope Ideally this should be done entirely different so params can follow wm scope and object lifetime.. --- WiFiManager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 0e4f36f..45aa4bf 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -59,6 +59,7 @@ WiFiManagerParameter::~WiFiManagerParameter() { if (_value != NULL) { delete[] _value; } + _length=0; // setting length 0, ideally the entire parameter should be removed, or added to wifimanager scope so it follows } void WiFiManagerParameter::setValue(const char *defaultValue, int length) { @@ -1095,7 +1096,8 @@ String WiFiManager::getParamOut(){ char parLength[5]; // add the extra parameters to the form for (int i = 0; i < _paramsCount; i++) { - if (_params[i] == NULL) { + if (_params[i] == NULL || _params[i]->_length == 0) { + DEBUG_WM(DEBUG_ERROR,"[ERROR] WiFiManagerParameter is out of scope"); break; }