[Libreoffice-commits] core.git: sw/source

Jim Raykowski (via logerrit) logerrit at kemper.freedesktop.org
Sun Aug 16 08:16:16 UTC 2020


 sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 8491657ade22b7bd9b5ed19ea5c58a0c3b5d9156
Author:     Jim Raykowski <raykowj at gmail.com>
AuthorDate: Thu Aug 13 19:04:07 2020 -0800
Commit:     Jim Raykowski <raykowj at gmail.com>
CommitDate: Sun Aug 16 10:15:39 2020 +0200

    assure pointer and position in OutlineContentVisibilityWin Set
    
    won't cause crash.
    
    Change-Id: Ic1bb2a1754c1a5a837370c7bb91bf7356e14b6bb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100716
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <raykowj at gmail.com>

diff --git a/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx b/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx
index ffebaf3e3f00..2bbc55504e95 100644
--- a/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx
+++ b/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx
@@ -66,9 +66,14 @@ void SwOutlineContentVisibilityWin::Set()
     const SwTextNode* pTextNode = pTextFrame->GetTextNodeFirst();
     SwWrtShell& rSh = GetEditWin()->GetView().GetWrtShell();
     const SwOutlineNodes& rOutlineNodes = rSh.GetNodes().GetOutLineNds();
-    (void)rOutlineNodes.Seek_Entry(static_cast<SwNode*>(const_cast<SwTextNode*>(pTextNode)),
-                                   &m_nOutlinePos);
-    assert(m_nOutlinePos != SwOutlineNodes::npos);
+    if (!pTextNode
+        || !rOutlineNodes.Seek_Entry(static_cast<SwNode*>(const_cast<SwTextNode*>(pTextNode)),
+                                     &m_nOutlinePos)
+        || m_nOutlinePos == SwOutlineNodes::npos)
+    {
+        assert(false); // should never get here
+        return;
+    }
 
     // don't set if no content and no subs with content
     auto nPos = m_nOutlinePos;


More information about the Libreoffice-commits mailing list