mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 15:06:14 +01:00
Check for empty property name in GPropertyAction
Make sure to fail consistently in case people created a GPropertyAction with g_object_new() without passing a property name. Bindings that construct objects with g_object_new() have no idea if a property is mandatory. See: #3130
This commit is contained in:
parent
525508be0d
commit
3a2af81ced
@ -313,6 +313,15 @@ g_property_action_set_property_name (GPropertyAction *paction,
|
|||||||
GParamSpec *pspec;
|
GParamSpec *pspec;
|
||||||
gchar *detailed;
|
gchar *detailed;
|
||||||
|
|
||||||
|
/* In case somebody is constructing GPropertyAction without passing
|
||||||
|
* a property name
|
||||||
|
*/
|
||||||
|
if (G_UNLIKELY (property_name == NULL || property_name[0] == '\0'))
|
||||||
|
{
|
||||||
|
g_critical ("Attempted to use an empty property name for GPropertyAction");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (paction->object), property_name);
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (paction->object), property_name);
|
||||||
|
|
||||||
if (pspec == NULL)
|
if (pspec == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user