sw/source/core/txtnode/ndtxt.cxx |   27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

New commits:
commit 56cda453daf71a368f316cb559e3e1f529e1c4fa
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Mon Sep 26 14:31:54 2016 +0200

    CppunitTest_sw_rtfimport: fix ASan/UBSan build failure
    
    pDocShell->GetWrtShell() can be nullptr, even if pDocShell is not.
    
    Change-Id: I2d60475abe545c2dbb13ede74d2d65432a3c93a7

diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 7e2470e..f833f7e 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1162,21 +1162,24 @@ void SwTextNode::Update(
         // The cursors of other shells shouldn't be moved, either.
         if (SwDocShell* pDocShell = GetDoc()->GetDocShell())
         {
-            for (SwViewShell& rShell : 
pDocShell->GetWrtShell()->GetRingContainer())
+            if (pDocShell->GetWrtShell())
             {
-                auto pWrtShell = dynamic_cast<SwWrtShell*>(&rShell);
-                if (!pWrtShell || pWrtShell == pDocShell->GetWrtShell())
-                    continue;
+                for (SwViewShell& rShell : 
pDocShell->GetWrtShell()->GetRingContainer())
+                {
+                    auto pWrtShell = dynamic_cast<SwWrtShell*>(&rShell);
+                    if (!pWrtShell || pWrtShell == pDocShell->GetWrtShell())
+                        continue;
 
-                SwShellCursor* pCursor = pWrtShell->GetCursor_();
-                if (!pCursor)
-                    continue;
+                    SwShellCursor* pCursor = pWrtShell->GetCursor_();
+                    if (!pCursor)
+                        continue;
 
-                SwIndex& rIndex = 
const_cast<SwIndex&>(pCursor->Start()->nContent);
-                if (&pCursor->Start()->nNode.GetNode() == this && 
rIndex.GetIndex() == rPos.GetIndex())
-                {
-                    // The cursor position of this other shell is exactly our 
insert position.
-                    rIndex.Assign(&aTmpIdxReg, rIndex.GetIndex());
+                    SwIndex& rIndex = 
const_cast<SwIndex&>(pCursor->Start()->nContent);
+                    if (&pCursor->Start()->nNode.GetNode() == this && 
rIndex.GetIndex() == rPos.GetIndex())
+                    {
+                        // The cursor position of this other shell is exactly 
our insert position.
+                        rIndex.Assign(&aTmpIdxReg, rIndex.GetIndex());
+                    }
                 }
             }
         }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to