From ea7ab15dc184f23fad8b853cbd227b39356c3732 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Mon, 19 Sep 2005 10:39:13 +0000 Subject: [PATCH] Missing null check 2005-09-19 Marco Pesenti Gritti * shell/ev-window-title.c: (ev_window_title_set_document): Missing null check --- ChangeLog | 6 ++++++ shell/ev-window-title.c | 32 ++++++++++++++++---------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index c0c38ff9..e3da7bdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-09-19 Marco Pesenti Gritti + + * shell/ev-window-title.c: (ev_window_title_set_document): + + Missing null check + 2005-09-17 Nickolay V. Shmyrev * shell/ev-view.c: (view_update_range_and_current_page): diff --git a/shell/ev-window-title.c b/shell/ev-window-title.c index 787c585e..cfa013e2 100644 --- a/shell/ev-window-title.c +++ b/shell/ev-window-title.c @@ -122,25 +122,25 @@ ev_window_title_set_document (EvWindowTitle *window_title, window_title->title = g_strdup (title); } - /* Some docs report titles with confusing extensions (ex. .doc for pdf). - Let's show the filename in this case */ - for (i = 0; i < G_N_ELEMENTS (bad_extensions); i++) { - if (bad_extensions[i].backend == ev_document_factory_get_backend (document) && - g_str_has_suffix (window_title->title, bad_extensions[i].ext)) { - char *new_title; - char *filename = get_filename_from_uri (uri); - - new_title = g_strdup_printf ("%s (%s)", window_title->title, filename); - g_free (window_title->title); - window_title->title = new_title; - - g_free (filename); - } - } - if (window_title->title) { char *p; + /* Some docs report titles with confusing extensions (ex. .doc for pdf). + Let's show the filename in this case */ + for (i = 0; i < G_N_ELEMENTS (bad_extensions); i++) { + if (bad_extensions[i].backend == ev_document_factory_get_backend (document) && + g_str_has_suffix (window_title->title, bad_extensions[i].ext)) { + char *new_title; + char *filename = get_filename_from_uri (uri); + + new_title = g_strdup_printf ("%s (%s)", window_title->title, filename); + g_free (window_title->title); + window_title->title = new_title; + + g_free (filename); + } + } + for (p = window_title->title; *p; ++p) { /* an '\n' byte is always ASCII, no need for UTF-8 special casing */ if (*p == '\n') -- 2.43.5