diff --git a/gio/gvfs.c b/gio/gvfs.c index 5805a7904..3475624cf 100644 --- a/gio/gvfs.c +++ b/gio/gvfs.c @@ -236,7 +236,7 @@ g_vfs_get_file_for_uri (GVfs *vfs, const char *uri) { GVfsClass *class; - GFile *ret; + GFile *ret = NULL; g_return_val_if_fail (G_IS_VFS (vfs), NULL); g_return_val_if_fail (uri != NULL, NULL); @@ -244,10 +244,12 @@ g_vfs_get_file_for_uri (GVfs *vfs, class = G_VFS_GET_CLASS (vfs); ret = get_file_for_uri_internal (vfs, uri); - if (ret) - return ret; + if (!ret) + ret = (* class->get_file_for_uri) (vfs, uri); - return (* class->get_file_for_uri) (vfs, uri); + g_assert (ret != NULL); + + return g_steal_pointer (&ret); } /**