mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1116] WiFiManagerParameters without ID sometimes get a length of 0 #954
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#954
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Lithimlin on GitHub (Aug 27, 2020).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1116
Basic Infos
Hardware
WiFimanager Branch/Release:
Esp8266/Esp32:
Hardware: ESP-12e, esp01, esp25
ESP Core Version: 2.4.0, staging
Description
When creating
WiFiManagerParameters 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 acontinueinstead of abreakwould be better in general.I also don't know why this only occurs sometimes. I haven't found a place where the
_lengthof a parameter is ever overwritten and it is never 0 when I assign it. It only occurs with parameters that have no ID, like theSeparatorParameterbelow.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
@Lithimlin commented on GitHub (Aug 27, 2020):
I just removed the length check and everything is working perfectly fine. Is that check even necessary?
@tablatronix commented on GitHub (Aug 27, 2020):
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.
@Lithimlin commented on GitHub (Aug 27, 2020):
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
_lengthfield just fine and correctly work with them. It's just that the_lengthis being set to 0 somewhere in the code. I tried to find all occurrences if the_lengthfield but it's not set to anything anywhere except when it's deconstructed. But I'm never actively deconstructing any of my parameters.