Commit 969c9742 authored by Richard Hughes's avatar Richard Hughes

Do not print a critical warning when misusing up_device_set_object_path_sync()

parent 5ed25a7e
......@@ -125,6 +125,7 @@ gboolean
up_device_set_object_path_sync (UpDevice *device, const gchar *object_path, GCancellable *cancellable, GError **error)
{
UpDeviceGlue *proxy_device;
gboolean ret = TRUE;
g_return_val_if_fail (UP_IS_DEVICE (device), FALSE);
g_return_val_if_fail (object_path != NULL, FALSE);
......@@ -132,6 +133,14 @@ up_device_set_object_path_sync (UpDevice *device, const gchar *object_path, GCan
if (device->priv->proxy_device != NULL)
return FALSE;
/* check valid */
if (!g_variant_is_object_path (object_path)) {
ret = FALSE;
g_set_error (error, 1, 0,
"Object path invalid: %s", object_path);
goto out;
}
g_clear_pointer (&device->priv->offline_props, g_hash_table_unref);
/* connect to the correct path for all the other methods */
......@@ -150,8 +159,8 @@ up_device_set_object_path_sync (UpDevice *device, const gchar *object_path, GCan
/* yay */
device->priv->proxy_device = proxy_device;
return TRUE;
out:
return ret;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment