Kaydet (Commit) f089b4fb authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#735614 Division or modulo by float zero

or

coverity#735615 Division or modulo by float zero

Change-Id: I6509e987eaf58349e81b9ebadcd7e2d0ff0bcbcb
üst cdbfbd0f
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
#include <com/sun/star/chart2/data/XDataReceiver.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp>
#include <com/sun/star/chart2/data/XDataSink.hpp> #include <com/sun/star/chart2/data/XDataSink.hpp>
#include <com/sun/star/chart2/data/LabeledDataSequence.hpp> #include <com/sun/star/chart2/data/LabeledDataSequence.hpp>
#include <o3tl/numeric.hxx>
#include <o3tl/ptr_container.hxx> #include <o3tl/ptr_container.hxx>
#include <sfx2/objsh.hxx> #include <sfx2/objsh.hxx>
#include <svx/svdpage.hxx> #include <svx/svdpage.hxx>
...@@ -325,12 +325,18 @@ sal_Int32 XclImpChRoot::CalcHmmFromChartY( sal_Int32 nPosY ) const ...@@ -325,12 +325,18 @@ sal_Int32 XclImpChRoot::CalcHmmFromChartY( sal_Int32 nPosY ) const
double XclImpChRoot::CalcRelativeFromHmmX( sal_Int32 nPosX ) const double XclImpChRoot::CalcRelativeFromHmmX( sal_Int32 nPosX ) const
{ {
return static_cast< double >( nPosX ) / mxChData->maChartRect.GetWidth(); const long nWidth = mxChData->maChartRect.GetWidth();
if (!nWidth)
throw o3tl::divide_by_zero();
return static_cast<double>(nPosX) / nWidth;
} }
double XclImpChRoot::CalcRelativeFromHmmY( sal_Int32 nPosY ) const double XclImpChRoot::CalcRelativeFromHmmY( sal_Int32 nPosY ) const
{ {
return static_cast< double >( nPosY ) / mxChData->maChartRect.GetHeight(); const long nHeight = mxChData->maChartRect.GetHeight();
if (!nHeight)
throw o3tl::divide_by_zero();
return static_cast<double >(nPosY) / nHeight;
} }
double XclImpChRoot::CalcRelativeFromChartX( sal_Int32 nPosX ) const double XclImpChRoot::CalcRelativeFromChartX( sal_Int32 nPosX ) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment