Small bug fixed: color chooser button was not showing the colors from the palette

This commit is contained in:
Matthias Koefferlein 2022-11-06 19:19:33 +01:00
parent 5b710fa3a4
commit 15ce9a79ea
1 changed files with 14 additions and 6 deletions

View File

@ -210,9 +210,13 @@ DitherPatternSelectionButton::update_menu ()
lay::DitherPattern patterns;
std::string s;
lay::Dispatcher::instance ()->config_get (cfg_stipple_palette, s);
lay::StipplePalette palette;
palette.from_string (s);
if (lay::Dispatcher::instance ()) {
lay::Dispatcher::instance ()->config_get (cfg_stipple_palette, s);
}
lay::StipplePalette palette = lay::StipplePalette::default_palette ();
if (! s.empty ()) {
palette.from_string (s);
}
// fill the list of stipple palette items
for (unsigned int i = 0; i < palette.stipples (); ++i) {
@ -910,9 +914,13 @@ ColorButton::build_color_menu (QMenu *menu, QObject *receiver, const char *brows
try {
std::string s;
lay::Dispatcher::instance ()->config_get (cfg_color_palette, s);
lay::ColorPalette palette;
palette.from_string (s);
if (lay::Dispatcher::instance ()) {
lay::Dispatcher::instance ()->config_get (cfg_color_palette, s);
}
lay::ColorPalette palette = lay::ColorPalette::default_palette ();
if (! s.empty ()) {
palette.from_string (s);
}
QMenu *submenu = 0;