sw/source/core/text/frmpaint.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit a082f1570d3faf9d65944339244bcf3b4bb3e3e9
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon May 2 11:37:18 2022 +0200
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Wed May 4 16:36:07 2022 +0200

    sw: avoid one more EXCEPTION_INT_DIVIDE_BY_ZERO
    
    Seen in
    
https://crashreport.libreoffice.org/stats/signature/SwTextFrame::PaintExtraData(SwRect%20const%20&)
    
    Change-Id: Ie6924254dca73360d384987834460a6f813e0d69
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133691
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    (cherry picked from commit fae937b6859517bd9fe8e400cad3c84561ff98ab)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133716
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 7f35ea7633b6..40221ff38c63 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -82,9 +82,14 @@ public:
         sal_Int16 eHor, bool bLnNm );
     SwFont* GetFont() const { return m_pFnt.get(); }
     void IncLineNr() { ++m_nLineNr; }
-    bool HasNumber() const { return !( m_nLineNr % m_rLineInf.GetCountBy() ); }
+    bool HasNumber() const {
+        if( m_rLineInf.GetCountBy() == 0 )
+            return false;
+        return !( m_nLineNr % m_rLineInf.GetCountBy() );
+    }
     bool HasDivider() const {
-        if( !m_nDivider ) return false;
+        if( !m_nDivider || m_rLineInf.GetDividerCountBy() == 0 )
+            return false;
         return !(m_nLineNr % m_rLineInf.GetDividerCountBy());
     }
 

Reply via email to