From 4d376e5e0c5f3605467d6efb0200667f201fc992 Mon Sep 17 00:00:00 2001 From: thecozies <79979276+thecozies@users.noreply.github.com> Date: Mon, 2 Sep 2024 10:47:09 -0500 Subject: [PATCH] parse/validate button config type --- librecomp/src/config/ConfigRegistry.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/librecomp/src/config/ConfigRegistry.cpp b/librecomp/src/config/ConfigRegistry.cpp index 0b1375a..199dad8 100644 --- a/librecomp/src/config/ConfigRegistry.cpp +++ b/librecomp/src/config/ConfigRegistry.cpp @@ -73,6 +73,22 @@ void register_config_option( config_registry.key_ref_map[this_key] = { config_group, json_path }; switch (type) { + case ConfigOptionType::Button: { + if (j.find("callback") != j.end()) { + if (!j["callback"].is_string()) { + TODO_PARSE_ERROR(this_key + "/callback" , "string"); + return; + } + } + if (j.find("variant") != j.end()) { + if (!j["variant"].is_string()) { + TODO_PARSE_ERROR(this_key + "/variant" , "string"); + return; + } + } + + break; + } case ConfigOptionType::TextField: { std::string default_val = ""; if (j.find("default") != j.end()) {