summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-09-26 14:31:54 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-09-26 14:31:54 +0200
commit56cda453daf71a368f316cb559e3e1f529e1c4fa (patch)
tree8fdee686955852785a47cc370e1e01b0764526e8 /sw/source/core
parentd8e91627b96e1325a8859d8ee54cdf5e15516bb9 (diff)
CppunitTest_sw_rtfimport: fix ASan/UBSan build failure
pDocShell->GetWrtShell() can be nullptr, even if pDocShell is not. Change-Id: I2d60475abe545c2dbb13ede74d2d65432a3c93a7
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx27
1 files changed, 15 insertions, 12 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 7e2470e1422b..f833f7e1849d 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());
+ }
}
}
}