1
0
mirror of https://github.com/s00500/ESPUI.git synced 2024-11-21 22:50:55 +00:00

Resolve null pointer exception

Adding a separator using `ESPUI.separator("Separator name");` triggers an exception when the code tries to access the property of an invalid object.
This commit is contained in:
joyfullservice 2024-09-25 15:07:13 -05:00
parent 66340823db
commit 8ca8241547

View File

@ -531,8 +531,15 @@ uint16_t ESPUIClass::addControl(
NotifyClients(ClientUpdateType_t::RebuildNeeded); NotifyClients(ClientUpdateType_t::RebuildNeeded);
if (control == nullptr)
{
return 0;
}
else
{
return control->id; return control->id;
} }
}
bool ESPUIClass::removeControl(uint16_t id, bool force_rebuild_ui) bool ESPUIClass::removeControl(uint16_t id, bool force_rebuild_ui)
{ {