From 22342055700384118a6af62b7292a974f526613a Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Fri, 17 Feb 2012 10:07:39 +0100 Subject: [PATCH] libmm-common: allow empty strings passed to the key value parser --- libmm-common/mm-common-helpers.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libmm-common/mm-common-helpers.c b/libmm-common/mm-common-helpers.c index 98f85bc5..422f954d 100644 --- a/libmm-common/mm-common-helpers.c +++ b/libmm-common/mm-common-helpers.c @@ -333,8 +333,13 @@ mm_common_parse_key_value_string (const gchar *str, g_return_val_if_fail (callback != NULL, FALSE); g_return_val_if_fail (str != NULL, FALSE); - dup = g_strdup (str); + /* Allow empty strings, we'll just return with success */ + while (g_ascii_isspace (*str)) + str++; + if (!str[0]) + return TRUE; + dup = g_strdup (str); p = dup; while (TRUE) {