mirror of
https://github.com/esphome/esphome.git
synced 2026-03-01 02:14:19 -07:00
Add NOLINT for length() > 0 cross-platform check
Arduino String has isEmpty() not empty(). Using length() > 0 works on both std::string and Arduino String.
This commit is contained in:
@@ -557,7 +557,8 @@ class WebServer : public Controller,
|
||||
template<typename T, typename Ret>
|
||||
void parse_bool_param_(AsyncWebServerRequest *request, ParamNameType param_name, T &call, Ret (T::*setter)(bool)) {
|
||||
const auto ¶m_value = request->arg(param_name);
|
||||
if (param_value.length() > 0) {
|
||||
// Arduino String has isEmpty() not empty(), use length() for cross-platform compatibility
|
||||
if (param_value.length() > 0) { // NOLINT(readability-container-size-empty)
|
||||
// First check on/off (default), then true/false (custom)
|
||||
auto val = parse_on_off(param_value.c_str());
|
||||
if (val == PARSE_NONE) {
|
||||
|
||||
Reference in New Issue
Block a user