diff options
author | Pranav Ganorkar <pranavg189@gmail.com> | 2017-01-28 23:43:08 +0530 |
---|---|---|
committer | Jonathan Kang <jonathan121537@gmail.com> | 2017-02-04 15:43:49 +0800 |
commit | 47e83b70d8248629cc47c66d08f062d9c94c2f62 (patch) | |
tree | 548a45fad1c4805d3838fb8e900c3547e204b44f /src | |
parent | 2975e340d276aa1b433092e81cf68ab4086b90b1 (diff) | |
download | gnome-logs-47e83b70d8248629cc47c66d08f062d9c94c2f62.tar.gz |
Fix crash when exact search type is selected
https://bugzilla.gnome.org/show_bug.cgi?id=777681
Diffstat (limited to 'src')
-rw-r--r-- | src/gl-journal-model.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/gl-journal-model.c b/src/gl-journal-model.c index 0f3b8f5..165315f 100644 --- a/src/gl-journal-model.c +++ b/src/gl-journal-model.c @@ -395,9 +395,6 @@ void gl_journal_model_take_query (GlJournalModel *model, GlQuery *query) { - GlQueryItem *search_match; - GPtrArray *search_matches; - g_return_if_fail (GL_JOURNAL_MODEL (model)); gl_journal_model_stop_idle (model); @@ -421,20 +418,30 @@ gl_journal_model_take_query (GlJournalModel *model, /* Set new query */ model->query = query; - search_matches = gl_query_get_substring_matches (model->query); + /* Tokenize the entered input only if search type is substring */ + if (query->search_type == GL_QUERY_SEARCH_TYPE_SUBSTRING) + { + GlQueryItem *search_match; + GPtrArray *search_matches; - /* Get search text from a search match */ - search_match = g_ptr_array_index (search_matches, 0); + search_matches = gl_query_get_substring_matches (model->query); + + /* Get search text from a search match */ + search_match = g_ptr_array_index (search_matches, 0); + + if (search_match->field_value != NULL) + { + model->token_array = tokenize_search_string (search_match->field_value); + } + + g_ptr_array_free (search_matches, TRUE); - if (search_match->field_value != NULL) - { - model->token_array = tokenize_search_string (search_match->field_value); } /* Start processing the new query */ gl_journal_model_process_query (model); - g_ptr_array_free (search_matches, TRUE); + } /* Add a new queryitem to query */ |