vcl/source/control/combobox.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
New commits: commit 122a0be8ae480473bd1d7f35e197a2529f4621e3 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Wed Nov 13 22:34:48 2019 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Thu Nov 14 10:20:18 2019 +0100 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.gran...@collabora.co.uk> Reviewed-by: Michael Stahl <michael.st...@cib.de> 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) ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits