config: fix type confusion in getOption with complex types

fixes https://github.com/hyprwm/Hyprland/discussions/13915
This commit is contained in:
Vaxry 2026-03-30 14:30:13 +01:00
parent bb84f4e91a
commit f57fd6ed37
Signed by: vaxry
GPG key ID: 665806380871D640

View file

@ -1773,7 +1773,7 @@ static std::string dispatchGetOption(eHyprCtlOutputFormat format, std::string re
else if (TYPE == typeid(Config::STRING))
return std::format("str: {}\nset: {}", **rc<Config::STRING* const*>(VAL), VAR.setByUser);
else if (TYPE == typeid(void*))
return std::format("custom type: {}\nset: {}", (*rc<Config::IComplexConfigValue* const*>(VAL))->toString(), VAR.setByUser);
return std::format("custom type: {}\nset: {}", rc<Config::IComplexConfigValue*>((*rc<Hyprlang::CUSTOMTYPE* const*>(VAL))->getData())->toString(), VAR.setByUser);
} else {
if (TYPE == typeid(Config::INTEGER))
return std::format(R"({{"option": "{}", "int": {}, "set": {} }})", curitem, **rc<Config::INTEGER* const*>(VAL), VAR.setByUser);
@ -1787,7 +1787,8 @@ static std::string dispatchGetOption(eHyprCtlOutputFormat format, std::string re
else if (TYPE == typeid(Config::STRING))
return std::format(R"({{"option": "{}", "str": "{}", "set": {} }})", curitem, **rc<Config::STRING* const*>(VAL), VAR.setByUser);
else if (TYPE == typeid(void*))
return std::format(R"({{"option": "{}", "custom": "{}", "set": {} }})", curitem, (*rc<Config::IComplexConfigValue* const*>(VAL))->toString(), VAR.setByUser);
return std::format(R"({{"option": "{}", "custom": "{}", "set": {} }})", curitem,
rc<Config::IComplexConfigValue*>((*rc<Hyprlang::CUSTOMTYPE* const*>(VAL))->getData())->toString(), VAR.setByUser);
}
return "invalid type (internal error)";