[evince/cherry-pick-ed0241a5] sidebar links: protect against NULL var reaching strcmp()



commit 22ec59ab9698c9cd586b5132226505dcaf0b66da
Author: Nelson Benítez León <nbenitezl gmail com>
Date:   Fri Mar 22 02:25:00 2019 +0000

    sidebar links: protect against NULL var reaching strcmp()
    
    Protect against a valid case of index_expand being NULL,
    by adding a NULL check prior to checking for empty string
    with strcmp().
    
    Fixes #1113
    
    
    (cherry picked from commit ed0241a5307e83484e25c01a8027504ea4dc35f3)

 shell/ev-sidebar-links.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c
index 8955d19c..29d3997e 100644
--- a/shell/ev-sidebar-links.c
+++ b/shell/ev-sidebar-links.c
@@ -518,7 +518,7 @@ row_collapsed_cb (GtkTreeView *tree_view,
                if (ev_metadata_get_string (metadata, "index-collapse", &index_collapse)) {
                        /* If collapsed row is not in 'index_collapse' we add it. */
                        if (g_strstr_len (index_collapse, -1, path_token) == NULL) {
-                               if (!strcmp (index_expand, ""))
+                               if (!index_expand || !strcmp (index_expand, ""))
                                        new_index = g_strconcat (index_collapse, path_token, NULL);
                                else
                                        new_index = g_strconcat (index_collapse, path_token + 1, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]