diff --git a/src/AutoConnectElementJsonImpl.h b/src/AutoConnectElementJsonImpl.h index 762950e..fd03913 100644 --- a/src/AutoConnectElementJsonImpl.h +++ b/src/AutoConnectElementJsonImpl.h @@ -346,18 +346,17 @@ bool AutoConnectSelectJson::loadMember(const JsonObject& json) { String type = json[F(AUTOCONNECT_JSON_KEY_TYPE)].as(); if (type.equalsIgnoreCase(F(AUTOCONNECT_JSON_TYPE_ACSELECT))) { _setMember(json); - if (json.containsKey(F(AUTOCONNECT_JSON_KEY_LABEL))) { + if (json.containsKey(F(AUTOCONNECT_JSON_KEY_LABEL))) label = json[F(AUTOCONNECT_JSON_KEY_LABEL)].as(); - } if (json.containsKey(F(AUTOCONNECT_JSON_KEY_OPTION))) { empty(); ArduinoJsonArray optionArray = json[AUTOCONNECT_JSON_KEY_OPTION]; for (auto value : optionArray) add(value.as()); + if (json.containsKey(F(AUTOCONNECT_JSON_KEY_SELECTED))) + selected = static_cast(json[F(AUTOCONNECT_JSON_KEY_SELECTED)].as()); return true; } - if (json.containsKey(F(AUTOCONNECT_JSON_KEY_SELECTED))) - selected = static_cast(json[F(AUTOCONNECT_JSON_KEY_SELECTED)].as()); } return false; }