From 8c729ee0da1896fff549236762a7236bb92420f8 Mon Sep 17 00:00:00 2001 From: joyfullservice Date: Fri, 27 Sep 2024 09:29:03 -0500 Subject: [PATCH] Remove unneeded arguments from separator function Implement an alternate strategy for avoiding the null pointer exception. This takes the same approach as the function to add a label. --- src/ESPUI.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/ESPUI.cpp b/src/ESPUI.cpp index 1db326f..68b1fef 100644 --- a/src/ESPUI.cpp +++ b/src/ESPUI.cpp @@ -531,14 +531,7 @@ uint16_t ESPUIClass::addControl( 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) @@ -667,7 +660,7 @@ uint16_t ESPUIClass::gauge(const char* label, ControlColor color, int number, in uint16_t ESPUIClass::separator(const char* label) { - return addControl(ControlType::Separator, label, "", ControlColor::Alizarin, Control::noParent, nullptr); + return addControl(ControlType::Separator, label, "", ControlColor::Alizarin); } uint16_t ESPUIClass::fileDisplay(const char* label, ControlColor color, String filename)