[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - chart2/source

Laurent Balland-Poirier laurent.balland-poirier at laposte.net
Thu Aug 20 02:21:05 PDT 2015


 chart2/source/view/main/VDataSeries.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit b001090ac2516e7c17612fa773be6bef6c30bb32
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date:   Sat Aug 15 15:03:41 2015 +0200

    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: I229f4c8f8fda54684e1c817ea7da06fd87eb79b9
    Reviewed-on: https://gerrit.libreoffice.org/17773
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx
index db15072..1631b03 100644
--- a/chart2/source/view/main/VDataSeries.cxx
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -522,9 +522,13 @@ void VDataSeries::getMinMaxXValue(double& fMin, double& fMax) const
     {
         double aValue;
 
-        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++)
         {
             aValue = aValuesX[i];
             if ( aValue > fMax)


More information about the Libreoffice-commits mailing list