Fix the crash of Regexp.Replace() when pcre2 library is used.

[GB.PCRE]
* BUG: Fix the crash of Regexp.Replace() when pcre2 library is used.
This commit is contained in:
Benoît Minisini 2023-08-25 03:05:49 +02:00
parent 75ff35c40f
commit c865a5a7e5

View file

@ -93,7 +93,7 @@ BEGIN_METHOD(RegExp_Replace, GB_STRING subject; GB_STRING pattern; GB_STRING rep
#endif #endif
exec(&r, GB.StringLength(subject) - offset); exec(&r, GB.StringLength(subject) - offset);
if (r.ovector[0] < 0) if (!r.ovector || r.ovector[0] < 0)
break; break;
_subst_regexp = &r; _subst_regexp = &r;