summaryrefslogtreecommitdiff
path: root/svtools/source/brwbox/brwbox1.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-11-01 15:55:14 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-11-01 21:02:10 +0000
commiteed1ea797acfe69af587adbefe60316ba6ba127f (patch)
tree6ff85540c568b4f2cfb7e3023b1ee2eff6cf637d /svtools/source/brwbox/brwbox1.cxx
parent445ac42cc2f2f759a43d97198039b980026ed70e (diff)
coverity#1250406 Division or modulo by float zero
and coverity#1250407 Division or modulo by float zero coverity#1250408 Division or modulo by float zero Change-Id: I77e4483356f7c0b287a29637cf6b958ee665ffec
Diffstat (limited to 'svtools/source/brwbox/brwbox1.cxx')
-rw-r--r--svtools/source/brwbox/brwbox1.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index caf2b417cb8a..51bfecb6114b 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -19,6 +19,7 @@
#include <svtools/brwbox.hxx>
#include <svtools/brwhead.hxx>
+#include <o3tl/numeric.hxx>
#include "datwin.hxx"
#include <tools/debug.hxx>
#include <tools/stream.hxx>
@@ -2418,7 +2419,6 @@ long BrowseBox::GetTitleHeight() const
return nTitleLines ? nTitleLines * nHeight + 4 : 0;
}
-
long BrowseBox::CalcReverseZoom(long nVal)
{
if (IsZoom())
@@ -2426,6 +2426,8 @@ long BrowseBox::CalcReverseZoom(long nVal)
const Fraction& rZoom = GetZoom();
double n = (double)nVal;
n *= (double)rZoom.GetDenominator();
+ if (!rZoom.GetNumerator())
+ throw o3tl::divide_by_zero();
n /= (double)rZoom.GetNumerator();
nVal = n>0 ? (long)(n + 0.5) : -(long)(-n + 0.5);
}
@@ -2445,8 +2447,6 @@ void BrowseBox::CursorMoved()
);
}
-
-
void BrowseBox::LoseFocus()
{
OSL_TRACE( "BrowseBox: %p->LoseFocus", this );