diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2016-08-09 08:40:05 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2016-08-10 09:04:54 +0200 |
commit | 7460793caafe86af21c73b96b709253ae79346b5 (patch) | |
tree | a917f4f25d1ecd1c1c49b33e8c0b6ec884cdd50d /libmm-glib/mm-common-helpers.c | |
parent | f9e4e6b8f12ef345117dff9dd8adc28cf5154383 (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.c | 9 |
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); |