diff options
| author | Tor Lillqvist <tml@collabora.com> | 2017-11-30 19:55:18 +0200 |
|---|---|---|
| committer | Stephan Bergmann <sbergman@redhat.com> | 2017-12-01 09:36:17 +0100 |
| commit | 2b0ff1adeb13efbf7fb0f46939738e3f895d7caf (patch) | |
| tree | 7a70dc0145f4f68dc383d7b23140d38e6297414d | |
| parent | a1087bace1aa2f91adebe9cd89e25189b222baed (diff) | |
Need to use dynamic_cast and not static_cast here, thanks UBSan and sberg
Change-Id: I95748f75fc4337481ec6574511bf4b1f47fc4587
Reviewed-on: https://gerrit.libreoffice.org/45611
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
| -rw-r--r-- | sc/source/filter/xml/xmlcondformat.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx index 2e8a2a66d1a3..08e8dbf827b5 100644 --- a/sc/source/filter/xml/xmlcondformat.cxx +++ b/sc/source/filter/xml/xmlcondformat.cxx @@ -232,10 +232,11 @@ void SAL_CALL ScXMLConditionalFormatContext::endFastElement( sal_Int32 /*nElemen for (size_t nFormatEntryIx = 0; nFormatEntryIx < pFormat->size(); ++nFormatEntryIx) { auto pFormatEntry = pFormat->GetEntry(nFormatEntryIx); - auto pCondFormatEntry = static_cast<const ScCondFormatEntry*>(pFormatEntry); + auto pCondFormatEntry = dynamic_cast<const ScCondFormatEntry*>(pFormatEntry); - if (pCondFormatEntry->GetOperation() != ScConditionMode::Equal && - pCondFormatEntry->GetOperation() != ScConditionMode::Direct) + if (pCondFormatEntry == nullptr || + (pCondFormatEntry->GetOperation() != ScConditionMode::Equal && + pCondFormatEntry->GetOperation() != ScConditionMode::Direct)) { bEligibleForCache = false; break; |
