sw/source/core/text/txttab.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
New commits: commit 790507731174466a8a041ff8052f2f703a73a524 Author: Michael Stahl <michael.st...@collabora.com> AuthorDate: Mon Aug 11 17:20:52 2025 +0200 Commit: Michael Stahl <michael.st...@collabora.com> CommitDate: Mon Aug 18 13:44:41 2025 +0200 sw: prevent negative width SwTabLeftPortion This will eventually assert in SwTabPortion::Paint(): sal/rtl/strtmpl.hxx:801: void rtl::str::new_WithLength(rtl_tString**, sal_Int32): Assertion `nLen >= 0' failed. Also move a comment from its current misleading position (this one is using TAB_OVER_SPACING). Change-Id: I0a8b347f7467fcd7176b75a5a7e5e672ad5e13d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189382 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit 3bfa151d6f834ef46f1f112ab670cc2d8af6de5c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189682 Reviewed-by: Michael Stahl <michael.st...@collabora.com> Tested-by: Jenkins diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index 14d8b9072693..8511571ac753 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -424,12 +424,11 @@ bool SwTabPortion::PreFormat(SwTextFormatInfo &rInf, SwTabPortion const*const pL } case PortionType::TabLeft: { - // handle this case in PostFormat if ((bTabOverMargin || bTabOverSpacing) && GetTabPos() > rInf.Width() && (!m_bAutoTabStop || rInf.Width() <= rInf.X())) { if (bTabOverMargin || GetTabPos() < nTextFrameWidth) - { + { // handle this case in PostFormat rInf.SetLastTab(this); break; } @@ -471,7 +470,7 @@ bool SwTabPortion::PreFormat(SwTextFormatInfo &rInf, SwTabPortion const*const pL // line if there is a fly reducing the line width: !rInf.GetFly() ) { - PrtWidth(rInf.Width() - rInf.X()); + PrtWidth(std::max(SwTwips{0}, rInf.Width() - rInf.X())); SetFixWidth( PrtWidth() ); } else