diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-05-02 11:37:18 +0200 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2022-05-04 16:35:45 +0200 |
commit | f1cc1d09934a45b47a3d4be44603d50859ce8e77 (patch) | |
tree | 2d55c16db3fed2cedc84c1b6aa1af6ab605d5463 | |
parent | 5459e6ef2554005ec045b76195ef1ba813a2dd34 (diff) |
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.grandin@collabora.co.uk>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit fae937b6859517bd9fe8e400cad3c84561ff98ab)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133715
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r-- | sw/source/core/text/frmpaint.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index 95ecf6cd54ff..8637faca988c 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()); } |