glocalfile: Assert against a potential NULL pointer dereference

This was confusing some static analysis. Through canonicalize_filename()
at construction time, we guaranteed that ->filename is canonical and
absolute, so g_path_skip_root() should never fail.

https://bugzilla.gnome.org/show_bug.cgi?id=731988
This commit is contained in:
Philip Withnall 2014-06-20 21:25:07 +01:00
parent 28dcafa09b
commit d09c219696

View File

@ -503,8 +503,11 @@ g_local_file_get_parent (GFile *file)
char *dirname;
GFile *parent;
/* Check for root */
/* Check for root; local->filename is guaranteed to be absolute, so
* g_path_skip_root() should never return NULL. */
non_root = g_path_skip_root (local->filename);
g_assert (non_root != NULL);
if (*non_root == 0)
return NULL;