sw/source/uibase/uno/unotxdoc.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit c5f3fd75e5ba6776d3e42482b96c5112ec3fc97f
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Nov 7 11:57:14 2024 +0000
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Nov 7 16:49:56 2024 +0100

    don't deref null m_pDocShell
    
    in the case of a failed load m_pDocShell is null and continuing
    is pointless.
    
     #0  0x00007efca0f0b157 in SwDocShell::GetView (this=0x0) at 
sw/inc/docsh.hxx:223
     #1  SwXTextDocument::getViewRenderState(SfxViewShell*) () at 
sw/source/uibase/uno/unotxdoc.cxx:3448
     #2  0x00007efcaec1d252 in doc_getCommandValues () at 
/opt/rh/devtoolset-12/root/usr/include/c++/12/bits/allocator.h:174
     #3  0x00000000005d8195 in lok::Document::getCommandValues 
(pCommand=0xb1ba39 ".uno:ViewRenderState", this=<optimized out>)
         at include/LibreOfficeKit/LibreOfficeKit.hxx:492
     #4  Document::load(std::shared_ptr<ChildSession> const&, std::string 
const&) () at kit/Kit.cpp:2012
     #5  0x00000000005da582 in Document::onLoad(std::string const&, std::string 
const&, std::string const&) () at kit/Kit.cpp:1227
    
    Change-Id: I5bc1415b06de4aea6a950486840e45773e61b78d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176209
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 7e00b8b279af..03bb7fc1cf1a 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3444,6 +3444,9 @@ SwXTextDocument::getSearchResultRectangles(const char* 
pPayload)
 
 OString SwXTextDocument::getViewRenderState(SfxViewShell* pViewShell)
 {
+    if (!m_pDocShell)
+        return OString();
+
     OStringBuffer aState;
     SwView* pView = pViewShell ? dynamic_cast<SwView*>(pViewShell) : 
m_pDocShell->GetView();
     if (pView && pView->GetWrtShellPtr())

Reply via email to