summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-11-07 11:57:14 +0000
committerMichael Stahl <michael.stahl@allotropia.de>2024-11-08 18:47:00 +0100
commitdbe432894049f45d563001e29739fb204268fab1 (patch)
treef7a2e986713613bffb0be98feb372dd37d5b8573
parent85ec0b184ac0e803f1fd0778a3397231e2d3289a (diff)
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 <caolan.mcnamara@collabora.com> Tested-by: Jenkins (cherry picked from commit 0fe2b2545da977cd462c06e2a6ec6551b9903497) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176226 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx3
1 files changed, 3 insertions, 0 deletions
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())