summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-04-02 20:26:53 +0100
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-04-05 19:13:31 +0900
commit3d7e533c75c6595d4a2491313cc7b8eeafc3c4a1 (patch)
tree2d9ae861a3afc457a812af3fd09cc1dd46fc2173 /vcl
parent8ebab95924434376e18cb6bb88e443b3454795ec (diff)
Related: tdf#124148 null-deref on clicking inside empty listbox
since... commit ce9dab8c161e29769131cec741a6a9cceec8552d Date: Thu Mar 28 17:43:29 2019 +0900 tdf#124148 add configurable margin for the listbox pop-up list Change-Id: Id0bedb86f4fb74aff230d65f1e4371959814fd0f Reviewed-on: https://gerrit.libreoffice.org/70151 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 728f074ab672469af933d492843230bd5c5bd0cd)
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/imp_listbox.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index 2f4f52fde220..b967808b928f 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -784,9 +784,11 @@ sal_Int32 ImplListBoxWindow::GetEntryPosForPoint( const Point& rPoint ) const
sal_Int32 nSelect = mnTop;
const ImplEntryType* pEntry = mpEntryList->GetEntryPtr( nSelect );
- long nEntryHeight = pEntry->getHeightWithMargin();
- while( pEntry && rPoint.Y() > nEntryHeight + nY )
+ while (pEntry)
{
+ long nEntryHeight = pEntry->getHeightWithMargin();
+ if (rPoint.Y() <= nEntryHeight + nY)
+ break;
nY += nEntryHeight;
pEntry = mpEntryList->GetEntryPtr( ++nSelect );
}