[evolution-data-server/gnome-3-28] Bug 796281 - [Calendar] Runtime warning when searching in empty Description



commit bd9bdfb62e428524ecfb8050de1a2c3c952ec3b7
Author: Milan Crha <mcrha redhat com>
Date:   Tue May 29 18:09:22 2018 +0200

    Bug 796281 - [Calendar] Runtime warning when searching in empty Description

 src/calendar/libecal/e-cal-component.c         | 8 +++++++-
 src/calendar/libedata-cal/e-cal-backend-sexp.c | 3 +--
 src/libedataserver/e-data-server-util.c        | 4 ++--
 3 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/calendar/libecal/e-cal-component.c b/src/calendar/libecal/e-cal-component.c
index 825f77020..a2e2c1fdc 100644
--- a/src/calendar/libecal/e-cal-component.c
+++ b/src/calendar/libecal/e-cal-component.c
@@ -2096,12 +2096,18 @@ get_text_list (GSList *text_list,
        for (l = text_list; l; l = l->next) {
                struct text *text;
                ECalComponentText *t;
+               const gchar *value;
 
                text = l->data;
                g_return_if_fail (text->prop != NULL);
 
+               value = (* get_prop_func) (text->prop);
+               /* Skip empty values */
+               if (!value || !*value)
+                       continue;
+
                t = g_new (ECalComponentText, 1);
-               t->value = (* get_prop_func) (text->prop);
+               t->value = value;
 
                if (text->altrep_param)
                        t->altrep = icalparameter_get_altrep (text->altrep_param);
diff --git a/src/calendar/libedata-cal/e-cal-backend-sexp.c b/src/calendar/libedata-cal/e-cal-backend-sexp.c
index 2d46b2931..faa2faf9e 100644
--- a/src/calendar/libedata-cal/e-cal-backend-sexp.c
+++ b/src/calendar/libedata-cal/e-cal-backend-sexp.c
@@ -374,9 +374,8 @@ matches_text_list (GSList *text_list,
                ECalComponentText *text;
 
                text = l->data;
-               g_return_val_if_fail (text->value != NULL, FALSE);
 
-               if (e_util_utf8_strstrcasedecomp (text->value, str) != NULL) {
+               if (text && e_util_utf8_strstrcasedecomp (text->value, str) != NULL) {
                        matches = TRUE;
                        break;
                }
diff --git a/src/libedataserver/e-data-server-util.c b/src/libedataserver/e-data-server-util.c
index 703413d16..09d78c978 100644
--- a/src/libedataserver/e-data-server-util.c
+++ b/src/libedataserver/e-data-server-util.c
@@ -384,10 +384,10 @@ e_util_utf8_strstrcasedecomp (const gchar *haystack,
        if (needle == NULL)
                return NULL;
 
-       if (strlen (needle) == 0)
+       if (!*needle)
                return haystack;
 
-       if (strlen (haystack) == 0)
+       if (!*haystack)
                return NULL;
 
        nuni = g_alloca (sizeof (gunichar) * strlen (needle));


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