ofz: loop in layout

Change-Id: I7c776d3b02bd8d35f160e82916213e402e9c88ab
This commit is contained in:
Caolán McNamara 2017-06-19 12:48:40 +01:00
parent 3b998365f4
commit 8b1bc1a3f5

View File

@ -367,19 +367,25 @@ bool LwpVirtualLayout::IsStyleLayout()
LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType) LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType)
{ {
LwpObjectID& rID = GetChildHead(); LwpObjectID& rID = GetChildHead();
LwpVirtualLayout* pPrevLayout = nullptr;
while(!rID.IsNull()) while(!rID.IsNull())
{ {
LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(rID.obj().get()); LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(rID.obj().get());
if (!pLayout) if (!pLayout)
break;
if (pPrevLayout && pLayout == pPrevLayout)
{ {
SAL_WARN("lwp", "loop in layout");
break; break;
} }
pPrevLayout = pLayout;
if (pLayout->GetLayoutType() == eType) if (pLayout->GetLayoutType() == eType)
{
return pLayout; return pLayout;
}
rID = pLayout->GetNext(); rID = pLayout->GetNext();
} }