summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-06-06 11:25:02 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-06-10 09:15:46 +0200
commit4dae3508de6d2340562f0c97ca4d00b03dcae42d (patch)
tree3ef14d7fff5554050158091909a3ca6ea9ee7926 /vcl
parentd701eff3519287db599a2612a635bc5f610ba082 (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 'vcl')
-rw-r--r--vcl/source/control/fmtfield.cxx2
1 files changed, 2 insertions, 0 deletions
diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx
index 3aee3317c829..359856c64486 100644
--- a/vcl/source/control/fmtfield.cxx
+++ b/vcl/source/control/fmtfield.cxx
@@ -1187,6 +1187,7 @@ void FormattedField::Up()
sal_Int64 nValue = std::round(rFormatter.GetValue() * nScale);
sal_Int64 nSpinSize = std::round(rFormatter.GetSpinSize() * nScale);
+ assert(nSpinSize != 0);
sal_Int64 nRemainder = rFormatter.GetDisableRemainderFactor() || nSpinSize == 0 ? 0 : nValue % nSpinSize;
if (nValue >= 0)
nValue = (nRemainder == 0) ? nValue + nSpinSize : nValue + nSpinSize - nRemainder;
@@ -1208,6 +1209,7 @@ void FormattedField::Down()
sal_Int64 nValue = std::round(rFormatter.GetValue() * nScale);
sal_Int64 nSpinSize = std::round(rFormatter.GetSpinSize() * nScale);
+ assert(nSpinSize != 0);
sal_Int64 nRemainder = rFormatter.GetDisableRemainderFactor() || nSpinSize == 0 ? 0 : nValue % nSpinSize;
if (nValue >= 0)
nValue = (nRemainder == 0) ? nValue - nSpinSize : nValue - nRemainder;