diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-12-20 11:10:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-12-20 12:14:40 +0000 |
commit | d35d01937ac77a12b06c1884dae2ec53998cf088 (patch) | |
tree | c5a5eb2d247d419600331a361a9e4466ea55a642 /editeng | |
parent | 383c309baac455f23ca78df031996cf2b56385d6 (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>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 6 |
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()) |