libnm-glib: add some missing precondition assertions

To validate the connection and path for NmObject subclass instances.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=778610
This commit is contained in:
Philip Withnall 2017-02-14 12:43:37 +00:00 committed by Thomas Haller
parent 84c484ed5b
commit 78058f7809
4 changed files with 12 additions and 0 deletions

View file

@ -174,6 +174,9 @@ nm_dhcp4_config_class_init (NMDHCP4ConfigClass *config_class)
GObject *
nm_dhcp4_config_new (DBusGConnection *connection, const char *object_path)
{
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (object_path != NULL, NULL);
return (GObject *) g_object_new (NM_TYPE_DHCP4_CONFIG,
NM_OBJECT_DBUS_CONNECTION, connection,
NM_OBJECT_DBUS_PATH, object_path,

View file

@ -174,6 +174,9 @@ nm_dhcp6_config_class_init (NMDHCP6ConfigClass *config_class)
GObject *
nm_dhcp6_config_new (DBusGConnection *connection, const char *object_path)
{
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (object_path != NULL, NULL);
return (GObject *) g_object_new (NM_TYPE_DHCP6_CONFIG,
NM_OBJECT_DBUS_CONNECTION, connection,
NM_OBJECT_DBUS_PATH, object_path,

View file

@ -330,6 +330,9 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class)
GObject *
nm_ip4_config_new (DBusGConnection *connection, const char *object_path)
{
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (object_path != NULL, NULL);
return (GObject *) g_object_new (NM_TYPE_IP4_CONFIG,
NM_OBJECT_DBUS_CONNECTION, connection,
NM_OBJECT_DBUS_PATH, object_path,

View file

@ -69,6 +69,9 @@ enum {
GObject *
nm_ip6_config_new (DBusGConnection *connection, const char *object_path)
{
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (object_path != NULL, NULL);
return (GObject *) g_object_new (NM_TYPE_IP6_CONFIG,
NM_OBJECT_DBUS_CONNECTION, connection,
NM_OBJECT_DBUS_PATH, object_path,