From 7460793caafe86af21c73b96b709253ae79346b5 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 9 Aug 2016 08:40:05 +0200 Subject: libmm-glib,helpers: don't warn when trying to read invalid match info index We may want to use the mm_get_()_from_match_info() calls to read optional items, so that the method returns FALSE if the item index doesn't apply. So, avoid the implicit warning issued by g_return_val_if_fail(). --- libmm-glib/mm-common-helpers.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libmm-glib/mm-common-helpers.c') diff --git a/libmm-glib/mm-common-helpers.c b/libmm-glib/mm-common-helpers.c index c1ddd896..4b784da0 100644 --- a/libmm-glib/mm-common-helpers.c +++ b/libmm-glib/mm-common-helpers.c @@ -1343,7 +1343,8 @@ mm_get_int_from_match_info (GMatchInfo *match_info, gboolean ret; s = g_match_info_fetch (match_info, match_index); - g_return_val_if_fail (s != NULL, FALSE); + if (!s) + return FALSE; ret = mm_get_int_from_str (s, out); g_free (s); @@ -1394,7 +1395,8 @@ mm_get_uint_from_match_info (GMatchInfo *match_info, gboolean ret; s = g_match_info_fetch (match_info, match_index); - g_return_val_if_fail (s != NULL, FALSE); + if (!s) + return FALSE; ret = mm_get_uint_from_str (s, out); g_free (s); @@ -1439,7 +1441,8 @@ mm_get_double_from_match_info (GMatchInfo *match_info, gboolean ret; s = g_match_info_fetch (match_info, match_index); - g_return_val_if_fail (s != NULL, FALSE); + if (!s) + return FALSE; ret = mm_get_double_from_str (s, out); g_free (s); -- cgit v1.2.3-70-g09d2