summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-12-20 11:10:03 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-12-20 14:24:39 +0000
commit41f5c6913770ceda96a92892af759d7f507ec043 (patch)
tree21effdd56c1544a2e6f65afdb44da2b64557a41e /editeng
parentf4bc4cbefb551e06b6e5df27bd03cee247faf6f3 (diff)
editeng: avoid divide by zero
Prevent mnColumns from ending up in a zero state. See https://crashreport.libreoffice.org/stats/signature/ImpEditEngine::CreateAndInsertEmptyLine(ParaPortion%20*) Change-Id: I9137a0de33743ba514526cc28f4afef018de3614 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144580 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit d35d01937ac77a12b06c1884dae2ec53998cf088) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144597 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/impedit3.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 2ce9a60f3eee..3191b7a874e7 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2832,8 +2832,14 @@ void ImpEditEngine::SetRotation(TextRotation nRotation)
void ImpEditEngine::SetTextColumns(sal_Int16 nColumns, sal_Int32 nSpacing)
{
+ assert(nColumns >= 1);
if (mnColumns != nColumns || mnColumnSpacing != nSpacing)
{
+ if (nColumns == 0)
+ {
+ SAL_WARN("editeng", "bad nColumns value, ignoring");
+ nColumns = 1;
+ }
mnColumns = nColumns;
mnColumnSpacing = nSpacing;
if (IsFormatted())