widgets: Don't show palette name with no palette

Resolves #14047
The Color Dialog that appears when you select a
text outline color does not load a palette from context.
Since we then try to get the name from a NULL palette,
this causes a crash.
This patch resolves the issue by adding a check for the
palette's existence before trying to get its name.
This commit is contained in:
Alx Sa 2025-05-19 19:34:47 +00:00
parent b25e489f6b
commit 1685c86af5

View file

@ -100,13 +100,16 @@ gimp_color_selector_palette_palette_changed (GimpContext *context,
GimpPalette *palette,
GimpColorSelectorPalette *select)
{
gchar *palette_name;
gimp_view_set_viewable (GIMP_VIEW (select->view), GIMP_VIEWABLE (palette));
if (palette != NULL)
{
gchar *palette_name;
g_object_get (palette, "name", &palette_name, NULL);
gtk_label_set_text (GTK_LABEL (select->name_label), palette_name);
g_free (palette_name);
}
}
static void