diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-06-06 11:25:02 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-06-10 09:15:46 +0200 |
commit | 4dae3508de6d2340562f0c97ca4d00b03dcae42d (patch) | |
tree | 3ef14d7fff5554050158091909a3ca6ea9ee7926 /sw/source/core | |
parent | d701eff3519287db599a2612a635bc5f610ba082 (diff) |
Add asserts to those places where I fixed a EXCEPTION_INT_DIVIDE_BY_ZERO
I found those crashes scraping https://crashreport.libreoffice.org/stats/
so those are blind fixes basically. Add these asserts,
hoping one day someone will hit them so we can find the root cause.
See
7c8b9fa98f4c5f7f5620e797dbbe24081e252548
fae937b6859517bd9fe8e400cad3c84561ff98ab
ce39195e533336ce1482e2be6b1bec2b7f992125
23e3bff528ab38c8d5c6d401b672a0033cef2bd4
ea4cd397300120a0f825752182eb3b943eb8a1b2
Change-Id: I175f47361e07961417c87cc8f3d7d4d1fb50fb2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135448
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/source/core')
-rw-r--r-- | sw/source/core/layout/atrfrm.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/text/frmpaint.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/porrst.cxx | 1 |
3 files changed, 4 insertions, 0 deletions
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 98588785cec3..2fcc7987d97b 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -1061,6 +1061,7 @@ void SwFormatCol::Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct ) rLastCol.SetLeft(nGutterHalf); rLastCol.SetRight(0); + assert(nAct != 0); //Convert the current width to the requested width. for (SwColumn &rCol: m_aColumns) { diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index 8637faca988c..36885753e514 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -83,11 +83,13 @@ public: SwFont* GetFont() const { return m_pFnt.get(); } void IncLineNr() { ++m_nLineNr; } bool HasNumber() const { + assert( m_rLineInf.GetCountBy() != 0 ); if( m_rLineInf.GetCountBy() == 0 ) return false; return !( m_nLineNr % m_rLineInf.GetCountBy() ); } bool HasDivider() const { + assert( m_rLineInf.GetDividerCountBy() != 0 ); if( !m_nDivider || m_rLineInf.GetDividerCountBy() == 0 ) return false; return !(m_nLineNr % m_rLineInf.GetDividerCountBy()); diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 498d1006108a..5e3d6921292d 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -644,6 +644,7 @@ bool SwBookmarkPortion::DoPaint(SwTextPaintInfo const& rTextPaintInfo, Size aSize(rFont.GetSize(rFont.GetActual())); // use also the external leading (line gap) of the portion, but don't use // 100% of it because i can't figure out how to baseline align that + assert(aSize.Height() != 0); auto const nFactor = aSize.Height() > 0 ? (Height() * 95) / aSize.Height() : Height(); rFont.SetProportion(nFactor); rFont.SetWeight(WEIGHT_THIN, rFont.GetActual()); |