sd/source/core/sdpage.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 60797d61e4d8641a4177089b204c1af8c8a3b594
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Fri Apr 3 16:40:18 2020 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Fri Apr 3 17:31:37 2020 +0200

    Fix uses of MAX_PRESOBJS
    
    ...broken in 10055ff899ed8f9c205155cd15c6de81cba37471 "convert PresObjKind 
to
    scoped enum", causing CppunitTest_sd_import_tests to fail with
    
    > sd/source/core/sdpage.cxx:1462:68: runtime error: index 7 out of bounds 
for type 'PresObjKind const[7]'
    >  #0 in findAutoLayoutShapesImpl(SdPage&, (anonymous 
namespace)::LayoutDescriptor const&, std::__debug::array<SdrObject*, 7ul>&, 
bool, bool) at sd/source/core/sdpage.cxx:1462:68
    >  #1 in SdPage::SetAutoLayout(AutoLayout, bool, bool) at 
sd/source/core/sdpage.cxx:1639:5
    >  #2 in SdGenericDrawPage::setPropertyValue(rtl::OUString const&, 
com::sun::star::uno::Any const&) at sd/source/ui/unoidl/unopage.cxx:624:28
    [...]
    
    Change-Id: I04a0b87e952ff2a93f939221cc424d83a59df9a9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91644
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 8f697e1ec2f5..7f8178dea79f 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -1459,7 +1459,7 @@ static void findAutoLayoutShapesImpl( SdPage& rPage, 
const LayoutDescriptor& rDe
     bool bMissing = false;
 
     // for each entry in the layoutdescriptor, arrange a presentation shape
-    for (int i = 0; (i <= static_cast<int>(PresObjKind::LAST)) && 
(rDescriptor.meKind[i] != PresObjKind::NONE); i++)
+    for (int i = 0; (i < MAX_PRESOBJS) && (rDescriptor.meKind[i] != 
PresObjKind::NONE); i++)
     {
         PresObjKind eKind = rDescriptor.meKind[i];
         SdrObject* pObj = nullptr;
@@ -1482,7 +1482,7 @@ static void findAutoLayoutShapesImpl( SdPage& rPage, 
const LayoutDescriptor& rDe
         return;
 
     // for each entry in the layoutdescriptor, look for an alternative shape
-    for (int i = 0; (i <= static_cast<int>(PresObjKind::LAST)) && 
(rDescriptor.meKind[i] != PresObjKind::NONE); i++)
+    for (int i = 0; (i < MAX_PRESOBJS) && (rDescriptor.meKind[i] != 
PresObjKind::NONE); i++)
     {
         if( rShapes[i] )
             continue;
@@ -1639,7 +1639,7 @@ void SdPage::SetAutoLayout(AutoLayout eLayout, bool 
bInit, bool bCreate )
     findAutoLayoutShapesImpl( *this, aDescriptor, aLayoutShapes, bInit, 
bSwitchLayout );
 
     // for each entry in the layoutdescriptor, arrange a presentation shape
-    for (int i = 0; (i <= static_cast<int>(PresObjKind::LAST)) && 
(aDescriptor.meKind[i] != PresObjKind::NONE); i++)
+    for (int i = 0; (i < MAX_PRESOBJS) && (aDescriptor.meKind[i] != 
PresObjKind::NONE); i++)
     {
         PresObjKind eKind = aDescriptor.meKind[i];
         SdrObject* pObj = InsertAutoLayoutShape( aLayoutShapes[i], eKind, 
aDescriptor.mbVertical[i], aRectangle[i], bInit );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to