mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 22:46:15 +01:00
gvfs: Add an assertion to check that get_file_for_uri() is never NULL
It cannot return a NULL value, as none of its callers have error handlng. Add an assertion to check the values returned by the VFS implementations. Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #1819
This commit is contained in:
parent
29388470f8
commit
e24503a8e9
10
gio/gvfs.c
10
gio/gvfs.c
@ -236,7 +236,7 @@ g_vfs_get_file_for_uri (GVfs *vfs,
|
|||||||
const char *uri)
|
const char *uri)
|
||||||
{
|
{
|
||||||
GVfsClass *class;
|
GVfsClass *class;
|
||||||
GFile *ret;
|
GFile *ret = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_VFS (vfs), NULL);
|
g_return_val_if_fail (G_IS_VFS (vfs), NULL);
|
||||||
g_return_val_if_fail (uri != NULL, 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);
|
class = G_VFS_GET_CLASS (vfs);
|
||||||
|
|
||||||
ret = get_file_for_uri_internal (vfs, uri);
|
ret = get_file_for_uri_internal (vfs, uri);
|
||||||
if (ret)
|
if (!ret)
|
||||||
return 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user