Kaydet (Commit) a45cad34 authored tarafından Laurent Balland-Poirier's avatar Laurent Balland-Poirier Kaydeden (comit) Caolán McNamara

tdf#76649 Skip NaN initial values for min and max

min and max were initiated as aValuesX[0] which could be NaN
test i before evaluating aValuesX[i]

Change-Id: I0246913dcf427e59fd354321eeffa7c08c41c08d
Reviewed-on: https://gerrit.libreoffice.org/17772Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 64291d69
......@@ -520,9 +520,13 @@ void VDataSeries::getMinMaxXValue(double& fMin, double& fMax) const
if(aValuesX.getLength() > 0)
{
fMax = fMin = aValuesX[0];
sal_Int32 i = 0;
while ( i < aValuesX.getLength() && ::rtl::math::isNan( aValuesX[i] ) )
i++;
if ( i < aValuesX.getLength() )
fMax = fMin = aValuesX[i++];
for (sal_Int32 i = 1; i < aValuesX.getLength(); i++)
for ( ; i < aValuesX.getLength(); i++)
{
const double aValue = aValuesX[i];
if ( aValue > fMax)
......
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