[libgweather] Fix crash when pressing enter on an empty entry
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather] Fix crash when pressing enter on an empty entry
- Date: Sat, 15 Feb 2014 14:43:53 +0000 (UTC)
commit baa6bce929aa869abc97b633416a4d1039a33261
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Feb 15 15:40:01 2014 +0100
Fix crash when pressing enter on an empty entry
libgweather/location-entry.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/libgweather/location-entry.c b/libgweather/location-entry.c
index 7712879..55f469e 100644
--- a/libgweather/location-entry.c
+++ b/libgweather/location-entry.c
@@ -576,8 +576,12 @@ static char *
find_word (const char *full_name, const char *word, int word_len,
gboolean whole_word, gboolean is_first_word)
{
- char *p = (char *)full_name - 1;
+ char *p;
+ if (word == NULL || *word == '\0')
+ return NULL;
+
+ p = (char *)full_name - 1;
while ((p = strchr (p + 1, *word))) {
if (strncmp (p, word, word_len) != 0)
continue;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]