fix param out of scope check, avoids some exceptions

This commit is contained in:
tablatronix
2022-01-24 14:13:03 -06:00
parent cf9d85fd6d
commit 4086e46f6c
+8 -3
View File
@@ -1625,15 +1625,20 @@ String WiFiManager::getParamOut(){
bool tok_c = HTTP_PARAM_temp.indexOf(FPSTR(T_c)) > 0;
char valLength[5];
// add the extra parameters to the form
for (int i = 0; i < _paramsCount; i++) {
if (_params[i] == NULL || _params[i]->_length == 0) {
Serial.println((String)_params[i]->_length);
if (_params[i] == NULL || _params[i]->_length == 0 || _params[i]->_length > 99999) {
// try to detect param scope issues, doesnt always catch but works ok
#ifdef WM_DEBUG_LEVEL
DEBUG_WM(DEBUG_ERROR,F("[ERROR] WiFiManagerParameter is out of scope"));
#endif
break;
return "";
}
}
// add the extra parameters to the form
for (int i = 0; i < _paramsCount; i++) {
// label before or after, @todo this could be done via floats or CSS and eliminated
String pitem;
switch (_params[i]->getLabelPlacement()) {