[epiphany/gnome-3-4] ephy-completion-model: normalize NULL strings to "" in should_add_bookmark_to_model



commit 6ff0b99cdee97cfa77456fe12f6b6c46081e0216
Author: Xan Lopez <xan igalia com>
Date:   Mon Apr 2 22:37:54 2012 +0200

    ephy-completion-model: normalize NULL strings to "" in should_add_bookmark_to_model
    
    Otherwise we can get false positives in the regexp, since the previous
    attempt at normalization would not properly take NULL strings into
    account.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=673301

 src/ephy-completion-model.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/ephy-completion-model.c b/src/ephy-completion-model.c
index 8b87059..d78e19d 100644
--- a/src/ephy-completion-model.c
+++ b/src/ephy-completion-model.c
@@ -261,10 +261,10 @@ should_add_bookmark_to_model (EphyCompletionModel *model,
     GRegex *current = NULL;
 
     for (iter = priv->search_terms; iter != NULL; iter = iter->next) {
-      current = (GRegex*) iter->data;
-      if (((title && !g_regex_match (current, title, G_REGEX_MATCH_NOTEMPTY, NULL))) &&
-          ((location && !g_regex_match (current, location, G_REGEX_MATCH_NOTEMPTY, NULL))) &&
-          ((keywords && !g_regex_match (current, keywords, G_REGEX_MATCH_NOTEMPTY, NULL)))) {
+      current = (GRegex*)iter->data;
+      if ((!g_regex_match (current, title ? title : "", G_REGEX_MATCH_NOTEMPTY, NULL)) &&
+          (!g_regex_match (current, location ? location : "", G_REGEX_MATCH_NOTEMPTY, NULL)) &&
+          (!g_regex_match (current, keywords ? keywords : "", G_REGEX_MATCH_NOTEMPTY, NULL))) {
         ret = FALSE;
         break;
       }



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