ofz: infinite loop
Change-Id: Ie42e73ebe02cd4c2bb10c9d0e55a5256b1fffd15 Reviewed-on: https://gerrit.libreoffice.org/59248 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
@@ -651,13 +651,16 @@ LwpDocument* LwpDocument::GetLastDivisionWithContents()
|
|||||||
return this;
|
return this;
|
||||||
|
|
||||||
LwpDocument* pDivision = GetFirstDivision();
|
LwpDocument* pDivision = GetFirstDivision();
|
||||||
|
std::set<LwpDocument*> aSeen;
|
||||||
while (pDivision)
|
while (pDivision)
|
||||||
{
|
{
|
||||||
|
aSeen.insert(pDivision);
|
||||||
LwpDocument* pContentDivision = pDivision->GetFirstDivisionWithContentsThatIsNotOLE();
|
LwpDocument* pContentDivision = pDivision->GetFirstDivisionWithContentsThatIsNotOLE();
|
||||||
if(pContentDivision)
|
if (pContentDivision)
|
||||||
return pContentDivision;
|
return pContentDivision;
|
||||||
pDivision = pDivision->GetNextDivision();
|
pDivision = pDivision->GetNextDivision();
|
||||||
|
if (aSeen.find(pDivision) != aSeen.end())
|
||||||
|
throw std::runtime_error("loop in conversion");
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user