aboutsummaryrefslogtreecommitdiff
path: root/libmm-glib/mm-common-helpers.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2016-08-09 08:40:05 +0200
committerAleksander Morgado <aleksander@aleksander.es>2016-08-10 09:04:54 +0200
commit7460793caafe86af21c73b96b709253ae79346b5 (patch)
treea917f4f25d1ecd1c1c49b33e8c0b6ec884cdd50d /libmm-glib/mm-common-helpers.c
parentf9e4e6b8f12ef345117dff9dd8adc28cf5154383 (diff)
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().
Diffstat (limited to 'libmm-glib/mm-common-helpers.c')
-rw-r--r--libmm-glib/mm-common-helpers.c9
1 files changed, 6 insertions, 3 deletions
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);