BUG: fix segfault if FindFiles() is called without actual match pattern
(e.g. FILE(GLOB /usr/include) instead of FILE(GLOB /usr/include/* ) #4620 Alex
This commit is contained in:
parent
326e114439
commit
a8128f88b7
|
@ -253,8 +253,9 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
|
||||||
|
|
||||||
if ( !dir_only || !kwsys::SystemTools::FileIsDirectory(realname.c_str()) )
|
if ( !dir_only || !kwsys::SystemTools::FileIsDirectory(realname.c_str()) )
|
||||||
{
|
{
|
||||||
if ( this->Internals->Expressions[
|
if ( (this->Internals->Expressions.size() > 0) &&
|
||||||
this->Internals->Expressions.size()-1].find(fname.c_str()) )
|
this->Internals->Expressions[
|
||||||
|
this->Internals->Expressions.size()-1].find(fname.c_str()) )
|
||||||
{
|
{
|
||||||
this->AddFile(this->Internals->Files, realname.c_str());
|
this->AddFile(this->Internals->Files, realname.c_str());
|
||||||
}
|
}
|
||||||
|
@ -277,6 +278,12 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
|
||||||
this->RecurseDirectory(start, dir, dir_only);
|
this->RecurseDirectory(start, dir, dir_only);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( start >= this->Internals->Expressions.size() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
kwsys::Directory d;
|
kwsys::Directory d;
|
||||||
if ( !d.Load(dir.c_str()) )
|
if ( !d.Load(dir.c_str()) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue