Avoid possible null dereference

If the link fails to resolve the return value will be NULL, so we shouldn't use
it before checking for NULL.
This commit is contained in:
Alexander Larsson
2017-02-28 10:44:54 +01:00
parent e1e27559d1
commit b2b6dd3af2

View File

@@ -2376,10 +2376,12 @@ add_file_args (GPtrArray *argv_array,
if (!path_is_visible (keys, n_keys, hash_table, path))
{
g_autofree char *resolved = flatpak_resolve_link (path, NULL);
g_autofree char *parent = g_path_get_dirname (path);
g_autofree char *relative = make_relative (parent, resolved);
if (resolved)
add_args (argv_array, "--symlink", relative, path, NULL);
{
g_autofree char *parent = g_path_get_dirname (path);
g_autofree char *relative = make_relative (parent, resolved);
add_args (argv_array, "--symlink", relative, path, NULL);
}
}
}
else if (ep->mode == FAKE_MODE_HIDDEN)