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

New commits:
commit dbe432894049f45d563001e29739fb204268fab1
Author:     Caolán McNamara <[email protected]>
AuthorDate: Thu Nov 7 11:57:14 2024 +0000
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Nov 8 18:47:00 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/+/176221
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit 0fe2b2545da977cd462c06e2a6ec6551b9903497)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176226
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 52c82a17fb20..f0587a8f6b5f 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3511,6 +3511,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