Open Lithimlin opened 4 years ago
I just removed the length check and everything is working perfectly fine. Is that check even necessary?
I had a feeling this was the cause, what kind of parameter has a length of 0?
This is not necessary but it was keeping some code from blowing up if users were trying to use params out of scope.
Are you sure you are not losing scope of your params ? If you are using callbacks make sure they are icache, and make sure you are not in some other interrupt etc.
As I said, no parameters of mine actually have a length of 0. It's always at least 1.
I'm pretty sure I'm not losing their scope since I can access the _length
field just fine and correctly work with them. It's just that the _length
is being set to 0 somewhere in the code. I tried to find all occurrences if the _length
field but it's not set to anything anywhere except when it's deconstructed. But I'm never actively deconstructing any of my parameters.
Basic Infos
Hardware
WiFimanager Branch/Release:
Esp8266/Esp32:
Hardware: ESP-12e, esp01, esp25
ESP Core Version: 2.4.0, staging
Description
When creating
WiFiManagerParameter
s without an ID, the length sometimes becomes 0, causing it and following parameters to not render. Is it necessary to check if the length is 0 and then skip all following parameters ingetParamOut()
? Maybe acontinue
instead of abreak
would be better in general.I also don't know why this only occurs sometimes. I haven't found a place where the
_length
of a parameter is ever overwritten and it is never 0 when I assign it. It only occurs with parameters that have no ID, like theSeparatorParameter
below.If you need more code, I'll try to provide it, but I'm trying to keep it simple here and my code has gotten quite complex. I hope the provided code is enough to pin down where the problem occurs.
In the particular example below, the first three parameters are rendered (three checkboxes). The fourth has a length of 0 and thus the fifth (another checkbox with the ID "use_mqtt") and following parameters are not rendered.
EDIT:
To be clear: When I say sometimes, I mean that I can compile the code and it may work. If I compile the same code again, it doesn't anymore.
Sketch
In
WiFiManager.cpp
:Debug Messages