sfx2/source/commandpopup/CommandPopup.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 32b820b7ac299de66965857a86feed895f91c4d5
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Wed Jul 14 11:39:07 2021 +0200
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Wed Jul 14 13:02:00 2021 +0200

    tdf#143342: fix crash when using "Search Command" feature
    
    Error: attempt to subscript container with out-of-bounds index -1, but
    container only holds 0 elements.
    
    Objects involved in the operation:
        sequence "this" @ 0x0x85b1d50 {
          type = std::__debug::vector<CurrentEntry, 
std::allocator<CurrentEntry> >;
        }
    
    4  0x00007fe75d569357 in CommandListBox::RowActivated(weld::TreeView&) 
(this=0x85b1d30) at sfx2/source/commandpopup/CommandPopup.cxx:202
    5  0x00007fe75d569649 in CommandListBox::TreeViewKeyPress(KeyEvent const&) 
(this=0x85b1d30, rKeyEvent=...) at sfx2/source/commandpopup/CommandPopup.cxx:222
    6  0x00007fe75d569170 in CommandListBox::LinkStubTreeViewKeyPress(void*, 
KeyEvent const&) (instance=0x85b1d30, data=...) at 
sfx2/source/commandpopup/CommandPopup.cxx:209
    
    Change-Id: I62923ce106da62e3d7d7572536f5e065773683ea
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118891
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/sfx2/source/commandpopup/CommandPopup.cxx 
b/sfx2/source/commandpopup/CommandPopup.cxx
index 5500f8913673..518e73a132b1 100644
--- a/sfx2/source/commandpopup/CommandPopup.cxx
+++ b/sfx2/source/commandpopup/CommandPopup.cxx
@@ -197,7 +197,7 @@ IMPL_LINK_NOARG(CommandListBox, RowActivated, 
weld::TreeView&, bool)
 {
     OUString aCommandURL;
     int nSelected = mpCommandTreeView->get_selected_index();
-    if (nSelected < int(maCommandList.size()))
+    if (nSelected != -1 && nSelected < int(maCommandList.size()))
     {
         auto const& rCurrent = maCommandList[nSelected];
         aCommandURL = rCurrent.m_aCommandURL;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to