Palette: Protects itself against initializing from Rules with no theme

This commit is contained in:
Paul Beckingham 2016-04-23 12:51:03 -04:00
parent 117587e1c5
commit bf7b48690b

View file

@ -51,9 +51,13 @@ Palette::Palette ()
////////////////////////////////////////////////////////////////////////////////
void Palette::initialize (const Rules& rules)
{
_colors.clear ();
for (auto& entry : rules.all ("theme.palette.color"))
_colors.push_back (Color (rules.get (entry)));
auto themeColors = rules.all ("theme.palette.color");
if (themeColors.size ())
{
_colors.clear ();
for (auto& entry : themeColors)
_colors.push_back (Color (rules.get (entry)));
}
}
////////////////////////////////////////////////////////////////////////////////