diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-11-13 22:34:48 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2019-11-14 10:20:18 +0100 |
commit | 122a0be8ae480473bd1d7f35e197a2529f4621e3 (patch) | |
tree | d0b99b63cf27b895540c4148af2cb2eb1ae0272a /vcl/source/control/combobox.cxx | |
parent | 52b15945ac14ae3ef8dd99a6b3067d61085e1315 (diff) |
Fix useless assert(true) (which would never fire)
526387b96e9bc2c04b0dc26744bf6b88ea7c0521 "loplugin:unnecessaryvirtual" had added
the assert (which was presumably meant to be an assert(false) instead, but had
somewhat oddly been added as part of that commit for no apparent reason), after
68ec95b3f80408ae50897b043eed69a07d084df9 "made ListBox handle more than 64k
elements, fdo#61520 related" had added the check+return.
But check+assert+return doesn't make sense. Either the checked condition cannot
happen (assert) or it can (return), but not both.
A `make check screenshot` didn't cause the (now active) assert to fire in my
local build, so lets assume that the condition cannot happen and the assert is
legitimate (and thus drop the return and simplify the code accordingly).
An alternative fix would be to show that the condition can happen, and to thus
drop the assert.
Change-Id: Id0059790d4f34c6645eadda9bca3184483e46bdf
Reviewed-on: https://gerrit.libreoffice.org/82642
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'vcl/source/control/combobox.cxx')
-rw-r--r-- | vcl/source/control/combobox.cxx | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 4b19c42ad5c4..e8a536f1f8ae 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -914,11 +914,7 @@ void ComboBox::RemoveEntry( const OUString& rStr ) void ComboBox::RemoveEntryAt(sal_Int32 const nPos) { const sal_Int32 nMRUCount = m_pImpl->m_pImplLB->GetEntryList()->GetMRUCount(); - if (nPos < 0 || nPos > COMBOBOX_MAX_ENTRIES - nMRUCount) - { - assert("bad position"); - return; - } + assert(nPos >= 0 && nPos <= COMBOBOX_MAX_ENTRIES - nMRUCount); m_pImpl->m_pImplLB->RemoveEntry( nPos + nMRUCount ); CallEventListeners( VclEventId::ComboboxItemRemoved, reinterpret_cast<void*>(nPos) ); } |