summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2024-06-21 08:26:52 +0200
committerMiklos Vajna <vmiklos@collabora.com>2024-06-25 08:27:22 +0200
commite005d2165794cb16efe79adf967271c6e0ee4047 (patch)
tree2e825674277519e7f3a55b3331ba1b11147e40db /sw/source
parent96ffaadbcd3010515b2465f7f87b599909db5913 (diff)
sw: fix assertion failure in SwView::ExecTabWin()
Crashreport signature: > /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_algo.h:3623: constexpr const _Tp& std::clamp(const _Tp&, const _Tp&, const _Tp&) [with _Tp = long int]: Assertion '!(__hi < __lo)' failed. > program/libswlo.so > long const& std::clamp<long>(long const&, long const&, long const&) > ??:? > program/libswlo.so > SwView::ExecTabWin(SfxRequest const&) > sw/source/uibase/uiview/viewtab.cxx:1139 > program/libmergedlo.so > SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) > sfx2/source/control/dispatch.cxx:257 Change-Id: I659fce002e5672c1c8c75fd130c7aae5b6a44460 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169447 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index 24d5585137fa..a454b7fd87a6 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1136,7 +1136,10 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
{
auto & rEntry = aTabCols.GetEntry(nIndex);
tools::Long nNewPosition = rEntry.nPos + nOffset;
- nNewPosition = std::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset);
+ tools::Long nMax = rEntry.nMax - constDistanceOffset;
+ if (nMax < rEntry.nMin)
+ nMax = rEntry.nMin;
+ nNewPosition = std::clamp(nNewPosition, rEntry.nMin, nMax);
rEntry.nPos = nNewPosition;
}