summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-07-02 16:21:26 +0100
committerAndras Timar <andras.timar@collabora.com>2015-08-06 12:52:54 +0200
commit5f0d1783edc7df2a25fe0aee4eb145196ef7c43a (patch)
tree7d0b03cc179e41067da3f74755d838c322d7e521 /vcl
parentb04f45f02d8af89b75e890d2911456eb74ff9ad6 (diff)
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)
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/ilstbox.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 98655e6b7c0a..2c8bab954f5a 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -1613,8 +1613,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))
@@ -1674,8 +1675,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 );