sc/source/ui/view/viewdata.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 5f0083fdee40e96d41c1ba736700dddfd968b6f8
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Sep 12 12:06:28 2024 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Sep 13 08:22:35 2024 +0200

    null pattern deref seen in ScViewData::SetEditEngine
    
    warn and use the default pool pattern if this happens
    
     #0  WhichRangesContainer::getOffsetFromWhich (this=this@entry=0x38, 
nWhich=nWhich@entry=129) at libreoffice/svl/source/items/itemset.cxx:1895
     #1  0x00007fe0179fa4ac in SfxItemSet::Get (this=0x10, nWhich=129, 
bSrchInParent=<optimized out>) at libreoffice/svl/source/items/itemset.cxx:1152
     #2  0x00007fe00736aa2e in ScPatternAttr::GetItem (nWhichP=129, this=0x0) 
at libreoffice/sc/inc/patattr.hxx:71
     #3  ScPatternAttr::GetItem<SvxHorJustifyItem> (nWhich=..., this=0x0) at 
libreoffice/sc/inc/patattr.hxx:73
     #4  ScViewData::SetEditEngine (this=this@entry=0x3323c540, 
eWhich=eWhich@entry=SC_SPLIT_BOTTOMLEFT, pNewEngine=<optimized out>, 
pWin=pWin@entry=0x32eec4f0, nNewX=nNewX@entry=-1, nNewY=nNewY@entry=-1)
         at libreoffice/sc/source/ui/view/viewdata.cxx:1613
     #5  0x00007fe00731c2f1 in ScTabView::UpdateEditView 
(this=this@entry=0x3323c538) at libreoffice/sc/source/ui/view/tabview3.cxx:2248
     #6  0x00007fe00731c9ae in ScTabView::UpdateFormulas 
(this=this@entry=0x3323c538, nStartCol=nStartCol@entry=-1, 
nStartRow=nStartRow@entry=-1, nEndCol=nEndCol@entry=-1, 
nEndRow=nEndRow@entry=-1)
         at libreoffice/sc/source/ui/view/tabview3.cxx:2393
     #7  0x00007fe007338bc5 in ScTabViewShell::Notify (this=0x3323c330, 
rBC=..., rHint=...) at libreoffice/sc/source/ui/view/tabvwsh5.cxx:219
     #8  0x00007fe017a29bb9 in SfxBroadcaster::Broadcast 
(this=this@entry=0x2fd10a70, rHint=...) at 
libreoffice/svl/source/notify/SfxBroadcaster.cxx:40
     #9  0x00007fe006f27c3f in ScDocShell::PostDataChanged 
(this=this@entry=0x2fd10a70) at libreoffice/sc/source/ui/docshell/docsh3.cxx:95
     #10 0x00007fe006f17dfc in ScDocShell::SetDocumentModified 
(this=this@entry=0x2fd10a70) at libreoffice/sc/source/ui/docshell/docsh.cxx:3050
     #11 0x00007fe007382e7c in ScViewFunc::DeleteTables 
(this=this@entry=0x3464aa28, TheTabs=std::vector of length 1, capacity 1 = 
{...}, bRecord=<optimized out>, bRecord@entry=true)
         at libreoffice/sc/source/ui/view/viewfun2.cxx:2656
     #12 0x00007fe007350825 in ScTabViewShell::ExecuteTable (this=0x3464a820, 
rReq=...) at libreoffice/sc/source/ui/view/tabvwshf.cxx:910
     #13 0x00007fe0175d0cef in SfxDispatcher::Call_Impl (this=0x340a1b70, 
rShell=..., rSlot=..., rReq=..., bRecord=<optimized out>)
         at libreoffice/sfx2/source/control/dispatch.cxx:254
     #14 0x00007fe0175d8daa in SfxDispatcher::Execute (this=0x340a1b70, 
nSlot=<optimized out>, nCall=nCall@entry=SfxCallMode::RECORD, 
pArgs=pArgs@entry=0x7ffe3c51edf0, 
pInternalArgs=pInternalArgs@entry=0x7ffe3c51ed90, nModi=0)
         at libreoffice/sfx2/source/control/dispatch.cxx:813
     #15 0x00007fe0176166f5 in SfxDispatchController_Impl::dispatch 
(this=<optimized out>, aURL=..., aArgs=uno::Sequence of length 1 = {...}, 
rListener=empty uno::Reference)
        at libreoffice/include/sfx2/ctrlitem.hxx:63
    
    Change-Id: Ib4851414a277a293d6bc44b4ffcd33d332e3c57e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173256
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 4d8542477fc7..4a4021b74ff7 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -46,6 +46,7 @@
 #include <attrib.hxx>
 #include <tabview.hxx>
 #include <tabvwsh.hxx>
+#include <docpool.hxx>
 #include <docsh.hxx>
 #include <patattr.hxx>
 #include <editutil.hxx>
@@ -1610,6 +1611,11 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
     bEditActive[eWhich] = true;
 
     const ScPatternAttr* pPattern = mrDoc.GetPattern(nNewX, nNewY, nTabNo);
+    if (!pPattern)
+    {
+        SAL_WARN("sc.viewdata", "No Pattern Found for: Col: " << nNewX << ", 
Row: " << nNewY << ", Tab: " << nTabNo);
+        pPattern = &(mrDoc.GetPool()->GetDefaultItem(ATTR_PATTERN));
+    }
     SvxCellHorJustify eJust = pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue();
 
     bool bBreak = ( eJust == SvxCellHorJustify::Block ) ||

Reply via email to