diff options
author | António Fernandes <antoniojpfernandes@gmail.com> | 2017-10-20 00:36:10 +0000 |
---|---|---|
committer | António Fernandes <antoniojpfernandes@gmail.com> | 2017-11-07 15:54:58 +0000 |
commit | 37a080b5765c6ed5d159253c3fe1ede992c5183a (patch) | |
tree | e8d19b92ee40952255ff0190864b083095b845ef | |
parent | 048a5f30709e8cf698f7fd35b3bd009e8db6e12b (diff) | |
download | nautilus-37a080b5765c6ed5d159253c3fe1ede992c5183a.tar.gz |
list-view: Don't try to get fts snippet for dummy row
If org.gnome.nautilus.list-view use-tree-view is TRUE, folders can
be expanded, which creates a dummy row to display the "Loading" label.
When displaying search results as a list, we look for the fts_snippet
on every row's NautilusFile, but this causes a crash when a dummy row is
created, because its NautilusFile is NULL.
Therefore, we should not look for fts_snippet on dummy rows.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/issues/54
(cherry picked from commit 0a67e3d5bbb283228d5daf576d63fb7847009cce)
-rw-r--r-- | src/nautilus-list-view.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c index 759e3b158..dc2280c74 100644 --- a/src/nautilus-list-view.c +++ b/src/nautilus-list-view.c @@ -1611,24 +1611,27 @@ filename_cell_data_func (GtkTreeViewColumn *column, NAUTILUS_LIST_MODEL_FILE_COLUMN, &file, -1); - snippet = nautilus_file_get_search_fts_snippet (file); - if (snippet) + /* Rule out dummy row */ + if (file != NULL) { - replaced_text = g_regex_replace (view->details->regex, - snippet, - -1, - 0, - " ", - G_REGEX_MATCH_NEWLINE_ANY, - NULL); + snippet = nautilus_file_get_search_fts_snippet (file); + if (snippet) + { + replaced_text = g_regex_replace (view->details->regex, + snippet, + -1, + 0, + " ", + G_REGEX_MATCH_NEWLINE_ANY, + NULL); - escaped_text = g_markup_escape_text (replaced_text, -1); + escaped_text = g_markup_escape_text (replaced_text, -1); - g_string_append_printf (display_text, - " <small><span color='grey'><b>%s</b></span></small>", - escaped_text); + g_string_append_printf (display_text, + " <small><span color='grey'><b>%s</b></span></small>", + escaped_text); + } } - nautilus_file_unref (file); } |