[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sc/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Tue Apr 24 13:50:28 UTC 2018


Rebased ref, commits from common ancestor:
commit 90037c05e5ddb4ca89ebd9fdef5291a48d514a53
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Tue Apr 24 10:39:44 2018 +0200

    Prevent crash while loading conditional formatting
    
    Manually cherry-picked from 2b0ff1adeb13efbf7fb0f46939738e3f895d7caf
    
    Change-Id: I48734ebdeab552f9f071dbd92ca9b286006cb075

diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx
index 3917e25f1cb0..d03f780edba4 100644
--- a/sc/source/filter/xml/xmlcondformat.cxx
+++ b/sc/source/filter/xml/xmlcondformat.cxx
@@ -232,10 +232,11 @@ void ScXMLConditionalFormatContext::EndElement()
     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() != SC_COND_EQUAL &&
-            pCondFormatEntry->GetOperation() != SC_COND_DIRECT)
+        if (pCondFormatEntry == nullptr ||
+            (pCondFormatEntry->GetOperation() != SC_COND_EQUAL &&
+             pCondFormatEntry->GetOperation() != SC_COND_DIRECT))
         {
             bEligibleForCache = false;
             break;


More information about the Libreoffice-commits mailing list