diff --git a/glib/gregex.c b/glib/gregex.c index f2a5b5fd1..6f3ee8812 100644 --- a/glib/gregex.c +++ b/glib/gregex.c @@ -2337,13 +2337,6 @@ g_regex_match_all_full (const GRegex *regex, info->match_data, info->match_context, info->workspace, info->n_workspace); - - if (!recalc_match_offsets (info, error)) - { - g_match_info_free (info); - return FALSE; - } - if (info->matches == PCRE2_ERROR_DFA_WSSIZE) { /* info->workspace is too small. */ @@ -2370,6 +2363,11 @@ g_regex_match_all_full (const GRegex *regex, _("Error while matching regular expression %s: %s"), regex->pattern, match_error (info->matches)); } + else if (info->matches > 0) + { + if (!recalc_match_offsets (info, error)) + info->matches = PCRE2_ERROR_NOMATCH; + } } pcre2_code_free (pcre_re);