BUG: if there is no match, don't construct the stl string from a NULL

pointer

Alex
This commit is contained in:
Alexander Neundorf 2007-08-22 09:25:14 -04:00
parent a47d3da969
commit a43976e91d
1 changed files with 8 additions and 1 deletions

View File

@ -379,7 +379,14 @@ inline kwsys_stl::string::size_type RegularExpression::end(int n) const
*/
inline kwsys_stl::string RegularExpression::match(int n) const
{
return kwsys_stl::string(this->startp[n], this->endp[n] - this->startp[n]);
if (this->startp[n]==0)
{
return kwsys_stl::string("");
}
else
{
return kwsys_stl::string(this->startp[n], this->endp[n] - this->startp[n]);
}
}
} // namespace @KWSYS_NAMESPACE@