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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 14 15:07:15 UTC 2021


 svx/source/sidebar/shapes/DefaultShapesPanel.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit c3a57aef1fe358dc7ac7df3593eaa0349a3c21a1
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jun 14 14:39:05 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jun 14 17:06:31 2021 +0200

    Resolves: tdf#142767 cannot use itemid of 0 in ValueSets
    
    Change-Id: I2c2b655b512e4e7869fe3784f1b073ecdbd0dac9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117166
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx
index 8b97bb5ee4d1..5bdf70ff6e68 100644
--- a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx
+++ b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx
@@ -121,8 +121,8 @@ IMPL_LINK(DefaultShapesPanel, ShapeSelectHdl, ValueSet*, rValueSet, void)
     {
         if(rValueSet == aSetMap.first)
         {
-            int aSelection = aSetMap.first->GetSelectedItemId();
-            comphelper::dispatchCommand(aSetMap.second[aSelection], {});
+            sal_uInt16 nSelectionId = aSetMap.first->GetSelectedItemId();
+            comphelper::dispatchCommand(aSetMap.second[nSelectionId - 1], {});
         }
         else
             aSetMap.first->SetNoSelection();
@@ -143,7 +143,8 @@ void DefaultShapesPanel::populateShapes()
             auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sSlotStr,
                 vcl::CommandInfoProvider::GetModuleIdentifier(mxFrame));
             sLabel = vcl::CommandInfoProvider::GetTooltipForCommand(sSlotStr, aProperties, mxFrame);
-            aSet.first->InsertItem(i, aSlotImage, sLabel);
+            sal_uInt16 nSelectionId = i + 1; // tdf#142767 id 0 is reserved for nothing-selected
+            aSet.first->InsertItem(nSelectionId, aSlotImage, sLabel);
         }
     }
 }


More information about the Libreoffice-commits mailing list