cleanup_subexpr();
if (!REG_MULTI) /* Single-line regexp */
{
- if (reg_endp[no] == NULL)
+ if (reg_startp[no] == NULL || reg_endp[no] == NULL)
{
/* Backref was not set: Match an empty string. */
len = 0;
}
else /* Multi-line regexp */
{
- if (reg_endpos[no].lnum < 0)
+ if (reg_startpos[no].lnum < 0 || reg_endpos[no].lnum < 0)
{
/* Backref was not set: Match an empty string. */
len = 0;
}
else
{
- if (submatch_match->endp[no] == NULL)
+ s = submatch_match->startp[no];
+ if (s == NULL || submatch_match->endp[no] == NULL)
retval = NULL;
else
- {
- s = submatch_match->startp[no];
retval = vim_strnsave(s, (int)(submatch_match->endp[no] - s));
- }
}
return retval;