summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-12-18 15:24:05 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-12-19 09:57:08 +0000
commitc8fa0a856e1c9063e16159982b410f3d33942d9a (patch)
tree06bf90d16b94f44f52c42d018632fd6b25a03490
parent7defa4d42fad580952405757b886aa0970baa3da (diff)
Resolves: rhbz#1175142 nStarts ends up as an invalid -1
Change-Id: Ic67c5562d0e9936cd6a524ecd4f798aaf885a6e8 (cherry picked from commit 1cd9420755dc5d5435bf564a992b727c455a3d73) (cherry picked from commit 4e8ae0f8187a9d3fa77d737f5de248cfd9b0ed55)
-rw-r--r--vcl/source/control/combobox.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index a5810f27a074..8620102f4476 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -297,7 +297,7 @@ IMPL_LINK( ComboBox, ImplAutocompleteHdl, Edit*, pEdit )
{
OUString aFullText = pEdit->GetText();
OUString aStartText = aFullText.copy( 0, (sal_Int32)aSel.Max() );
- sal_Int32 nStart = mpImplLB->GetCurrentPos();
+ sal_Int32 nStart = mpImplLB->GetCurrentPos();
if ( nStart == LISTBOX_ENTRY_NOTFOUND )
nStart = 0;
@@ -308,7 +308,10 @@ IMPL_LINK( ComboBox, ImplAutocompleteHdl, Edit*, pEdit )
else if ( eAction == AUTOCOMPLETE_TABBACKWARD )
{
bForward = false;
- nStart = nStart ? nStart - 1 : mpImplLB->GetEntryList()->GetEntryCount()-1;
+ if (nStart)
+ nStart = nStart - 1;
+ else if (mpImplLB->GetEntryList()->GetEntryCount())
+ nStart = mpImplLB->GetEntryList()->GetEntryCount()-1;
}
sal_Int32 nPos = LISTBOX_ENTRY_NOTFOUND;