diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-13 10:26:32 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-13 13:14:27 +0100 |
commit | a4e0d20c7eff8b053ec754b0a4b89dcb26636bf5 (patch) | |
tree | 18af8e97f196ea60540867f7d79def4a03147a77 /lotuswordpro | |
parent | 75426421b9ae754dc1144f3c8df3da404183817b (diff) |
ofz: better loop detection
Change-Id: I285358064ab9c02b5818bc0452ae3c35962778c6
Reviewed-on: https://gerrit.libreoffice.org/49630
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index 5dc583dce675..b18896468f22 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -1314,18 +1314,17 @@ bool LwpMiddleLayout::IsProtected() rtl::Reference<LwpVirtualLayout> LwpMiddleLayout::GetWaterMarkLayout() { rtl::Reference<LwpVirtualLayout> xLay(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get())); + std::set<LwpVirtualLayout*> aSeen; while (xLay.is()) { + aSeen.insert(xLay.get()); if (xLay->IsForWaterMark()) { return xLay; } rtl::Reference<LwpVirtualLayout> xNext(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get())); - if (xNext == xLay) - { - SAL_WARN("lwp", "loop in layout"); - break; - } + if (aSeen.find(xNext.get()) != aSeen.end()) + throw std::runtime_error("loop in conversion"); xLay = xNext; } return rtl::Reference<LwpVirtualLayout>(); |