sc/source/core/data/patattr.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit dca19993a4c78ba7f7d61b254763909c0e5831b9
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sat Jan 6 14:40:28 2024 +0100
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Sun Jan 7 11:38:45 2024 +0100

    tdf#159042: crash after changing cell style (if direct formatting done)
    
    bt part:
    1  0x00007f1fdd439356 in rtl::OUString::operator 
std::basic_string_view<char16_t, std::char_traits<char16_t> >() const 
(this=0x0) at include/rtl/ustring.hxx:3333
    2  0x00007f1fddaf1927 in CellAttributeHelper::CellStyleCreated(ScDocument&, 
std::basic_string_view<char16_t, std::char_traits<char16_t> >) 
(this=0x55edd85576a0, rDoc=..., rName=u"Default")
       at /home/julien/lo/libreoffice/sc/source/core/data/patattr.cxx:193
    3  0x00007f1fdeed225b in ScTabViewShell::ExecStyle(SfxRequest&) 
(this=0x55edd8674190, rReq=...) at 
/home/julien/lo/libreoffice/sc/source/ui/view/tabvwsha.cxx:1601
    
    full bt here:
    https://bugs.documentfoundation.org/attachment.cgi?id=191786
    
    Regression from:
    
https://cgit.freedesktop.org/libreoffice/core/commit/?id=2e1f9da8a6359c8909e087a92239aefd4851b116
    Decouple ScPatternAttr from SfxItemPool
    
    Change-Id: I8c996326abe870c6ce71e9d130e73fb3b025bf71
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161710
    Tested-by: Julien Nabet <serval2...@yahoo.fr>
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 4092dab7fff5..4d44e744d807 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -190,7 +190,7 @@ void CellAttributeHelper::CellStyleCreated(ScDocument& 
rDoc, std::u16string_view
     // for undo or clipboard content.
     for (const ScPatternAttr* pCheck : maRegisteredCellAttributes)
     {
-        if (nullptr == pCheck->GetStyleSheet() && rName == 
*pCheck->GetStyleName())
+        if (nullptr == pCheck->GetStyleSheet() && pCheck->GetStyleName() && 
rName == *pCheck->GetStyleName())
             const_cast<ScPatternAttr*>(pCheck)->UpdateStyleSheet(rDoc); // 
find and store style pointer
     }
 }

Reply via email to