[select] Fix -Wmaybe-uninitialized warnings on ESP8266 (#14759)

This commit is contained in:
J. Nick Koston
2026-03-13 03:20:50 -10:00
committed by Jesse Hills
parent 18b54f075e
commit e9c2659147

View File

@@ -41,7 +41,7 @@ SelectCall &SelectCall::with_index(size_t index) {
this->operation_ = SELECT_OP_SET;
if (index >= this->parent_->size()) {
ESP_LOGW(TAG, "'%s' - Index value %zu out of bounds", this->parent_->get_name().c_str(), index);
this->index_ = {}; // Store nullopt for invalid index
this->index_ = nullopt; // Store nullopt for invalid index
} else {
this->index_ = index;
}
@@ -52,7 +52,7 @@ optional<size_t> SelectCall::calculate_target_index_(const char *name) {
const auto &options = this->parent_->traits.get_options();
if (options.empty()) {
ESP_LOGW(TAG, "'%s' - Select has no options", name);
return {};
return nullopt;
}
if (this->operation_ == SELECT_OP_FIRST) {
@@ -67,7 +67,7 @@ optional<size_t> SelectCall::calculate_target_index_(const char *name) {
ESP_LOGD(TAG, "'%s' - Setting", name);
if (!this->index_.has_value()) {
ESP_LOGW(TAG, "'%s' - No option set", name);
return {};
return nullopt;
}
return this->index_;
}
@@ -96,7 +96,7 @@ optional<size_t> SelectCall::calculate_target_index_(const char *name) {
return active_index + 1;
}
return {}; // Can't navigate further without cycling
return nullopt; // Can't navigate further without cycling
}
void SelectCall::perform() {