childproxy: gracefully handle methods being NULL

Do this for all method invoke functions for consistency.

https://bugzilla.gnome.org/show_bug.cgi?id=750154
This commit is contained in:
Tim-Philipp Müller 2018-01-20 15:30:53 +00:00
parent d06dca135d
commit db1d99db76

View file

@ -117,10 +117,16 @@ gst_child_proxy_default_get_child_by_name (GstChildProxy * parent,
GObject * GObject *
gst_child_proxy_get_child_by_name (GstChildProxy * parent, const gchar * name) gst_child_proxy_get_child_by_name (GstChildProxy * parent, const gchar * name)
{ {
GstChildProxyInterface *iface;
g_return_val_if_fail (GST_IS_CHILD_PROXY (parent), 0); g_return_val_if_fail (GST_IS_CHILD_PROXY (parent), 0);
return (GST_CHILD_PROXY_GET_INTERFACE (parent)->get_child_by_name (parent, iface = GST_CHILD_PROXY_GET_INTERFACE (parent);
name));
if (iface->get_child_by_name != NULL)
return iface->get_child_by_name (parent, name);
return NULL;
} }
/** /**
@ -138,10 +144,16 @@ gst_child_proxy_get_child_by_name (GstChildProxy * parent, const gchar * name)
GObject * GObject *
gst_child_proxy_get_child_by_index (GstChildProxy * parent, guint index) gst_child_proxy_get_child_by_index (GstChildProxy * parent, guint index)
{ {
GstChildProxyInterface *iface;
g_return_val_if_fail (GST_IS_CHILD_PROXY (parent), NULL); g_return_val_if_fail (GST_IS_CHILD_PROXY (parent), NULL);
return (GST_CHILD_PROXY_GET_INTERFACE (parent)->get_child_by_index (parent, iface = GST_CHILD_PROXY_GET_INTERFACE (parent);
index));
if (iface->get_child_by_index != NULL)
return iface->get_child_by_index (parent, index);
return NULL;
} }
/** /**
@ -157,9 +169,16 @@ gst_child_proxy_get_child_by_index (GstChildProxy * parent, guint index)
guint guint
gst_child_proxy_get_children_count (GstChildProxy * parent) gst_child_proxy_get_children_count (GstChildProxy * parent)
{ {
GstChildProxyInterface *iface;
g_return_val_if_fail (GST_IS_CHILD_PROXY (parent), 0); g_return_val_if_fail (GST_IS_CHILD_PROXY (parent), 0);
return (GST_CHILD_PROXY_GET_INTERFACE (parent)->get_children_count (parent)); iface = GST_CHILD_PROXY_GET_INTERFACE (parent);
if (iface->get_children_count != NULL)
return iface->get_children_count (parent);
return 0;
} }
/** /**