diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-04-14 12:32:59 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2017-04-19 21:33:01 +0200 |
commit | 9d991e69e3103145d655123b464cc806ee4cc3f4 (patch) | |
tree | 68d7806a44449fa2264a5c5ec7d11f061a54e08b /sc | |
parent | cf54824b1d507b00a2d02a513f3b78170fb8f1ba (diff) |
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@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/unoobj/PivotTableDataProvider.cxx | 24 |
1 files changed, 16 insertions, 8 deletions
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; + } } } |