Restore hasArg guard in parse_string_param_

Empty string is a valid value for string params (e.g. select
options). Must use hasArg to distinguish missing from empty.
This commit is contained in:
J. Nick Koston
2026-02-11 18:17:24 -06:00
parent 91a0b0989e
commit 592d5ec24c

View File

@@ -543,9 +543,8 @@ class WebServer : public Controller,
template<typename T, typename Ret>
void parse_string_param_(AsyncWebServerRequest *request, ParamNameType param_name, T &call,
Ret (T::*setter)(const std::string &)) {
const auto &value = request->arg(param_name);
// Arduino String has isEmpty() not empty(), use length() for cross-platform compatibility
if (value.length() > 0) { // NOLINT(readability-container-size-empty)
if (request->hasArg(param_name)) {
const auto &value = request->arg(param_name);
(call.*setter)(std::string(value.c_str(), value.length()));
}
}