~ Combos can have no default value

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
Alexis Maiquez 2021-12-02 22:00:43 +01:00
parent 342522cd1d
commit d0572b257f

View File

@ -503,7 +503,7 @@ namespace WallpaperEngine::Render::Shaders
{
json data = json::parse (content);
auto combo = jsonFindRequired (data, "combo", "cannot parse combo information");
auto defvalue = jsonFindRequired (data, "default", "cannot parse combo information");
auto defvalue = data.find ("default");
// add line feed just in case
this->m_compiledContent += "\n";
@ -516,7 +516,12 @@ namespace WallpaperEngine::Render::Shaders
if (entry == this->m_combos->end ())
{
// if no combo is defined just load the default settings
if ((*defvalue).is_number_float ())
if (defvalue == data.end ())
{
// TODO: PROPERLY SUPPORT EMPTY COMBOS
this->m_combos->insert (std::make_pair <std::string, int> (*combo, 0));
}
else if ((*defvalue).is_number_float ())
{
throw std::runtime_error ("float combos not supported");
}