[Libreoffice-commits] core.git: sw/source

Caolán McNamara caolanm at redhat.com
Sat May 12 11:31:17 UTC 2018


 sw/source/ui/misc/pggrid.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 86d7984cac6687edd6be2a86fae49c0a10d14627
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 11 15:41:34 2018 +0100

    coverity#1430102 Division by zero
    
    Change-Id: Iae44c89c4af70e3e5b19137ee08ca566c7a04fb7
    Reviewed-on: https://gerrit.libreoffice.org/54141
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 0a1185e45765..24b8c06aaef6 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -405,9 +405,11 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField&, rField, void)
     }
     else//in normal mode
     {
-        if(m_pLinesPerPageNF == &rField)
+        if (m_pLinesPerPageNF == &rField)
         {
-            long nHeight = static_cast< sal_Int32 >(m_aPageSize.Height() / m_pLinesPerPageNF->GetValue());
+            auto nValue = m_pLinesPerPageNF->GetValue();
+            assert(nValue && "div-by-zero");
+            long nHeight = static_cast< sal_Int32 >(m_aPageSize.Height() / nValue);
             m_pTextSizeMF->SetValue(m_pTextSizeMF->Normalize(nHeight), FUNIT_TWIP);
             m_pRubySizeMF->SetValue(0, FUNIT_TWIP);
             SetLinesOrCharsRanges( *m_pLinesRangeFT , m_pLinesPerPageNF->GetMax() );


More information about the Libreoffice-commits mailing list