summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2016-08-09 08:40:05 +0200
committerDan Williams <dcbw@redhat.com>2016-12-06 11:46:24 -0600
commit396413eb94b995de8a3bb6bf0a82b35081ceabdb (patch)
treed1ab767b5acfda8cab1fb2dc69f22901856a80a0
parentb252c57466da62f6cbf05b002788b6ee7ce06930 (diff)
downloadModemManager-396413eb94b995de8a3bb6bf0a82b35081ceabdb.tar.gz
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(). (cherry picked from commit 7460793caafe86af21c73b96b709253ae79346b5)
-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 c1ddd8966..4b784da0c 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);