[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - vcl/source

Caolán McNamara caolanm at redhat.com
Mon Jul 6 01:48:50 PDT 2015


 vcl/source/control/ilstbox.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 3d10947eb35a1bdd9475e1e02739075c4a4ab644
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jul 2 16:21:26 2015 +0100

    Resolves: tdf#92467 crashes with empty history list on pressing down
    
    regression from some 16->32 bit listbox limit changing
    
    Change-Id: I045eeef935afed4154fe11bfd11916c2d6a722e9
    (cherry picked from commit c51d5706205cd0282c07d778ffac5f265c3eaf5f)
    (cherry picked from commit a8ddd3b0280baa1b770f439fbbca9ff073faa16b)
    Reviewed-on: https://gerrit.libreoffice.org/16699
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index e6e4c59..4fa8c7e 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -1619,8 +1619,9 @@ bool ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
         )
     {
         DBG_ASSERT( !mpEntryList->IsEntryPosSelected( nSelect ) || mbMulti, "ImplListBox: Selecting same Entry" );
-        if( nSelect >= mpEntryList->GetEntryCount() )
-            nSelect = mpEntryList->GetEntryCount()-1;
+        sal_Int32 nCount = mpEntryList->GetEntryCount();
+        if (nSelect >= nCount)
+            nSelect = nCount ? nCount-1 : LISTBOX_ENTRY_NOTFOUND;
         bool bCurPosChange = (mnCurrentPos != nSelect);
         mnCurrentPos = nSelect;
         if(SelectEntries( nSelect, eLET, bShift, bCtrl, bCurPosChange))
@@ -1680,8 +1681,9 @@ void ImplListBoxWindow::SelectEntry( ::vcl::StringEntryIdentifier _entry )
 
     // normalize
     OSL_ENSURE( nSelect < mpEntryList->GetEntryCount(), "ImplListBoxWindow::SelectEntry: how that?" );
-    if( nSelect >= mpEntryList->GetEntryCount() )
-        nSelect = mpEntryList->GetEntryCount()-1;
+    sal_Int32 nCount = mpEntryList->GetEntryCount();
+    if (nSelect >= nCount)
+        nSelect = nCount ? nCount-1 : LISTBOX_ENTRY_NOTFOUND;
 
     // make visible
     ShowProminentEntry( nSelect );


More information about the Libreoffice-commits mailing list