sc/source/core/data/document.cxx | 3 +++ sc/source/ui/sparklines/SparklineList.cxx | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-)
New commits: commit 27aa7df0a093c9e18ce591d8c73b524ef7ff40de Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sun Apr 3 13:57:36 2022 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Wed Apr 6 02:59:37 2022 +0200 sc: prevent a crash when deleting a sparkline Change-Id: Idf89d4bbdc2bd29ce55cc3a8fd6707ece345869c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132553 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 32ab6d73538d..60dc6b749b82 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -6656,6 +6656,9 @@ std::shared_ptr<sc::SparklineGroup> ScDocument::SearchSparklineGroup(tools::Guid { for (auto const& rTable : maTabs) { + if (!rTable) + continue; + auto& rSparklineList = rTable->GetSparklineList(); for (auto const& pSparklineGroup : rSparklineList.getSparklineGroups()) diff --git a/sc/source/ui/sparklines/SparklineList.cxx b/sc/source/ui/sparklines/SparklineList.cxx index 744a58bce66e..7ee52ac74e27 100644 --- a/sc/source/ui/sparklines/SparklineList.cxx +++ b/sc/source/ui/sparklines/SparklineList.cxx @@ -31,7 +31,8 @@ std::vector<std::shared_ptr<SparklineGroup>> SparklineList::getSparklineGroups() for (auto iterator = m_aSparklineGroups.begin(); iterator != m_aSparklineGroups.end();) { - if (auto pSparklineGroup = iterator->lock()) + auto pWeakGroup = *iterator; + if (auto pSparklineGroup = pWeakGroup.lock()) { toReturn.push_back(pSparklineGroup); iterator++;