libgimpwidgets: handle invalid enum values in gimp_enum_store_set_icon_prefix()
If the store has invalid enum values the function segfaults, instead of just ignoring them. We use -1 to represent separator rows in the layer mode combo; if we end up adding icons to this combo, we need it... not to segfault. Since this is public API, it should probably be prepared to handle such uses regardless.
This commit is contained in:
@ -375,9 +375,12 @@ gimp_enum_store_set_icon_prefix (GimpEnumStore *store,
|
||||
|
||||
enum_value = g_enum_get_value (store->enum_class, value);
|
||||
|
||||
icon_name = g_strconcat (icon_prefix, "-",
|
||||
enum_value->value_nick,
|
||||
NULL);
|
||||
if (enum_value)
|
||||
{
|
||||
icon_name = g_strconcat (icon_prefix, "-",
|
||||
enum_value->value_nick,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (store), &iter,
|
||||
|
||||
Reference in New Issue
Block a user