[Libreoffice-commits] core.git: sc/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Wed Apr 19 19:33:30 UTC 2017


 sc/source/ui/unoobj/PivotTableDataProvider.cxx |   24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

New commits:
commit 9d991e69e3103145d655123b464cc806ee4cc3f4
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Fri Apr 14 12:32:59 2017 +0200

    tdf#107072 fix crash when only a row and data fields are present
    
    If a pivot table only has a row field and data field, creating a
    pivot chart crashes. The crash happens when setting the labels
    for a data series as there is none set. This fixes the problem
    with setting a fixed "Total" label in this case.
    
    Change-Id: I870c5c635ee64abb635296329dcfc277834f8f03
    Reviewed-on: https://gerrit.libreoffice.org/36626
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    Tested-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
index 35e24b6197fc..9cd932a3415a 100644
--- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx
+++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
@@ -585,16 +585,24 @@ uno::Reference<chart2::data::XDataSource>
 
             OUString aLabel;
             bool bFirst = true;
-            for (ValueAndFormat const & rItem : m_aLabels[i])
+
+            if (m_aLabels.empty())
             {
-                if (bFirst)
-                {
-                    aLabel += rItem.m_aString;
-                    bFirst = false;
-                }
-                else
+                aLabel = "Total";
+            }
+            else
+            {
+                for (ValueAndFormat const & rItem : m_aLabels[i])
                 {
-                    aLabel += " - " + rItem.m_aString;
+                    if (bFirst)
+                    {
+                        aLabel += rItem.m_aString;
+                        bFirst = false;
+                    }
+                    else
+                    {
+                        aLabel += " - " + rItem.m_aString;
+                    }
                 }
             }
 


More information about the Libreoffice-commits mailing list