From f71434d2e250e86c808b3c7ad7098a5d28a348bf Mon Sep 17 00:00:00 2001 From: Christian Neumair Date: Thu, 28 Feb 2008 18:56:46 +0000 Subject: [PATCH] Handle NULL file. Ignore lines beginning with a space (#512593). 2008-02-28 Christian Neumair * libnautilus-private/nautilus-file.c: (nautilus_file_get_gicon): Handle NULL file. * src/nautilus-bookmark-list.c: (nautilus_bookmark_list_load_file): Ignore lines beginning with a space (#512593). svn path=/trunk/; revision=13852 --- ChangeLog | 7 +++++++ libnautilus-private/nautilus-file.c | 4 ++++ src/nautilus-bookmark-list.c | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index af99b2ae0..4bf062834 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-02-28 Christian Neumair + + * libnautilus-private/nautilus-file.c: (nautilus_file_get_gicon): + Handle NULL file. + * src/nautilus-bookmark-list.c: (nautilus_bookmark_list_load_file): + Ignore lines beginning with a space (#512593). + 2008-02-28 Alexander Larsson * src/file-manager/fm-directory-view.c: diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c index 281a29a09..bd01fb832 100644 --- a/libnautilus-private/nautilus-file.c +++ b/libnautilus-private/nautilus-file.c @@ -3269,6 +3269,10 @@ nautilus_file_get_gicon (NautilusFile *file, int i; gboolean changed; + if (file == NULL) { + return NULL; + } + if (file->details->icon) { icon = NULL; diff --git a/src/nautilus-bookmark-list.c b/src/nautilus-bookmark-list.c index 832e0a5bf..0d401fcae 100644 --- a/src/nautilus-bookmark-list.c +++ b/src/nautilus-bookmark-list.c @@ -453,7 +453,8 @@ nautilus_bookmark_list_load_file (NautilusBookmarkList *bookmarks) lines = g_strsplit (contents, "\n", -1); for (i = 0; lines[i]; i++) { - if (lines[i][0]) { + /* Ignore empty or invalid lines that cannot be parsed properly */ + if (lines[i][0] != '\0' && lines[i][0] != ' ') { /* gtk 2.7/2.8 might have labels appended to bookmarks which are separated by a space */ /* we must seperate the bookmark uri and the potential label */ char *space, *label; -- GitLab