[GB.PCRE]
* BUG: Don't call GB.ReturnNewString() if a match returns a null string. git-svn-id: svn://localhost/gambas/trunk@5991 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
fbaee4554f
commit
43b9446d42
1 changed files with 7 additions and 1 deletions
|
@ -144,6 +144,8 @@ static void exec(void *_object, int lsubject)
|
|||
|
||||
static void return_match(void *_object, int index)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (index < 0 || index >= THIS->count)
|
||||
{
|
||||
GB.Error("Out of bounds");
|
||||
|
@ -151,7 +153,11 @@ static void return_match(void *_object, int index)
|
|||
}
|
||||
|
||||
index *= 2;
|
||||
GB.ReturnNewString(&THIS->subject[THIS->ovector[index]], THIS->ovector[index + 1] - THIS->ovector[index]);
|
||||
len = THIS->ovector[index + 1] - THIS->ovector[index];
|
||||
if (len <= 0)
|
||||
GB.ReturnNull();
|
||||
else
|
||||
GB.ReturnNewString(&THIS->subject[THIS->ovector[index]], len);
|
||||
}
|
||||
|
||||
bool REGEXP_match(const char *subject, int lsubject, const char *pattern, int lpattern, int coptions, int eoptions)
|
||||
|
|
Loading…
Reference in a new issue