summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-02-23 21:12:41 +0000
committerMichael Stahl <michael.stahl@allotropia.de>2023-02-24 08:57:11 +0000
commit09d6e6c81633eef6eaecf011dc766cdc68e52fd7 (patch)
tree7a62eab048572b1796fd079263194f3b2b59e239 /sc
parent0f305c976c4a619f53154d13be134d3bbe6f3302 (diff)
crashtesting: null-deref seen on loading forum-mso-en4-399427.xlsx
and others. A problem since: commit 8c9a6abf30e9ff1ebd5647f7c271e0d64643860a Date: Thu Feb 2 20:16:04 2023 +0100 tdf#138601 XLSX import: fix priority of conditional formatting rules Change-Id: I663b193c5bd7c5c92d3c423e70b0f7a24e3e5d76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147552 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/oox/condformatbuffer.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 1abb3bf91938..ac5c2738aa47 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1172,11 +1172,12 @@ void CondFormatBuffer::finalizeImport()
minIndex = i;
for (size_t j = i + 1; j < maCondFormats.size(); ++j)
{
- if (maCondFormats[j]->maRules.begin()->first
- < maCondFormats[minIndex]->maRules.begin()->first)
- {
+ const CondFormat::CondFormatRuleMap& rNextRules = maCondFormats[j]->maRules;
+ const CondFormat::CondFormatRuleMap& rMinRules = maCondFormats[minIndex]->maRules;
+ if (rNextRules.empty() || rMinRules.empty())
+ continue;
+ if (rNextRules.begin()->first < rMinRules.begin()->first)
minIndex = j;
- }
}
if (i != minIndex)
std::swap(maCondFormats[i], maCondFormats[minIndex]);