[Libreoffice-commits] core.git: lotuswordpro/source

Caolán McNamara caolanm at redhat.com
Thu Jun 15 13:54:54 UTC 2017


 lotuswordpro/source/filter/lwppagelayout.cxx |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 9e15697b5ec21114e32466762dab94cba1bfe97b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 15 14:53:32 2017 +0100

    ofz: loop in layout
    
    Change-Id: I8c1561f37f8b24258c95ec09edf8c4be61300959

diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx
index 66d58fc104eb..d4313c9e0e17 100644
--- a/lotuswordpro/source/filter/lwppagelayout.cxx
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -495,7 +495,13 @@ LwpHeaderLayout* LwpPageLayout::GetHeaderLayout()
     {
         if (xLay->GetLayoutType() == LWP_HEADER_LAYOUT)
             return dynamic_cast<LwpHeaderLayout*>(xLay.get());
-        xLay.set(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
+        rtl::Reference<LwpVirtualLayout> xNext(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
+        if (xNext == xLay)
+        {
+            SAL_WARN("lwp", "loop in layout");
+            break;
+        }
+        xLay = xNext;
     }
     return nullptr;
 }
@@ -507,7 +513,13 @@ LwpFooterLayout* LwpPageLayout::GetFooterLayout()
     {
         if (xLay->GetLayoutType() == LWP_FOOTER_LAYOUT)
             return dynamic_cast<LwpFooterLayout*>(xLay.get());
-        xLay.set(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
+        rtl::Reference<LwpVirtualLayout> xNext(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
+        if (xNext == xLay)
+        {
+            SAL_WARN("lwp", "loop in layout");
+            break;
+        }
+        xLay = xNext;
     }
     return nullptr;
 }


More information about the Libreoffice-commits mailing list