diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-05-20 11:49:44 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-05-20 17:08:48 +0200 |
commit | ce39195e533336ce1482e2be6b1bec2b7f992125 (patch) | |
tree | dd137d95515effa4847b597a1e78deb6ba0c4d14 /vcl | |
parent | 73ed5e36047b6f46b3777bf6f36591ec4babb1f9 (diff) |
vcl: avoid EXCEPTION_INT_DIVIDE_BY_ZERO
See https://crashreport.libreoffice.org/stats/signature/FormattedField::Down()
or https://crashreport.libreoffice.org/stats/signature/FormattedField::Up()
Change-Id: I30dfb06a1261a48a75b9d9c2380ed78121758ec2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134674
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/fmtfield.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx index f027ada878e5..c07b7e3ab3c5 100644 --- a/vcl/source/control/fmtfield.cxx +++ b/vcl/source/control/fmtfield.cxx @@ -1180,7 +1180,7 @@ void FormattedField::Up() sal_Int64 nValue = std::round(rFormatter.GetValue() * nScale); sal_Int64 nSpinSize = std::round(rFormatter.GetSpinSize() * nScale); - sal_Int64 nRemainder = rFormatter.GetDisableRemainderFactor() ? 0 : nValue % nSpinSize; + sal_Int64 nRemainder = rFormatter.GetDisableRemainderFactor() || nSpinSize == 0 ? 0 : nValue % nSpinSize; if (nValue >= 0) nValue = (nRemainder == 0) ? nValue + nSpinSize : nValue + nSpinSize - nRemainder; else @@ -1201,7 +1201,7 @@ void FormattedField::Down() sal_Int64 nValue = std::round(rFormatter.GetValue() * nScale); sal_Int64 nSpinSize = std::round(rFormatter.GetSpinSize() * nScale); - sal_Int64 nRemainder = rFormatter.GetDisableRemainderFactor() ? 0 : nValue % nSpinSize; + sal_Int64 nRemainder = rFormatter.GetDisableRemainderFactor() || nSpinSize == 0 ? 0 : nValue % nSpinSize; if (nValue >= 0) nValue = (nRemainder == 0) ? nValue - nSpinSize : nValue - nRemainder; else |