From 8572ecfd7cc823097ff80de54ed6d7e17059c4fb Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 16 Feb 2012 12:50:03 -0600 Subject: [PATCH] libnm-glib: don't crash on unknown object types Like when an old libnm-glib is being run against a newer NM when a new device type has been added. --- libnm-glib/nm-object.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c index f7c2894173..a470a8757d 100644 --- a/libnm-glib/nm-object.c +++ b/libnm-glib/nm-object.c @@ -445,6 +445,11 @@ _nm_object_create (GType type, DBusGConnection *connection, const char *path) if (type_func) type = type_func (connection, path); + if (type == G_TYPE_INVALID) { + g_warning ("Could not create object for %s: unknown object type", path); + return NULL; + } + object = g_object_new (type, NM_OBJECT_DBUS_CONNECTION, connection, NM_OBJECT_DBUS_PATH, path,