diff options
-rw-r--r-- | lotuswordpro/source/filter/lwpfnlayout.cxx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lotuswordpro/source/filter/lwpfnlayout.cxx b/lotuswordpro/source/filter/lwpfnlayout.cxx index febf995acffc..b91b86a3dab1 100644 --- a/lotuswordpro/source/filter/lwpfnlayout.cxx +++ b/lotuswordpro/source/filter/lwpfnlayout.cxx @@ -244,20 +244,18 @@ LwpVirtualLayout* LwpEnSuperTableLayout::GetMainTableLayout() { LwpObjectID* pID = &GetChildTail(); - LwpVirtualLayout* pPrevLayout = nullptr; + o3tl::sorted_vector<LwpVirtualLayout*> aSeen; while (!pID->IsNull()) { LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(pID->obj().get()); - if (!pLayout || pLayout == pPrevLayout) - { + if (!pLayout) break; - } + bool bAlreadySeen = !aSeen.insert(pLayout).second; + if (bAlreadySeen) + throw std::runtime_error("loop in conversion"); if (pLayout->GetLayoutType() == LWP_ENDNOTE_LAYOUT) - { return pLayout; - } pID = &pLayout->GetPrevious(); - pPrevLayout = pLayout; } return nullptr; |