Kaydet (Commit) 56cda453 authored tarafından Miklos Vajna's avatar Miklos Vajna

CppunitTest_sw_rtfimport: fix ASan/UBSan build failure

pDocShell->GetWrtShell() can be nullptr, even if pDocShell is not.

Change-Id: I2d60475abe545c2dbb13ede74d2d65432a3c93a7
üst d8e91627
...@@ -1162,21 +1162,24 @@ void SwTextNode::Update( ...@@ -1162,21 +1162,24 @@ void SwTextNode::Update(
// The cursors of other shells shouldn't be moved, either. // The cursors of other shells shouldn't be moved, either.
if (SwDocShell* pDocShell = GetDoc()->GetDocShell()) if (SwDocShell* pDocShell = GetDoc()->GetDocShell())
{ {
for (SwViewShell& rShell : pDocShell->GetWrtShell()->GetRingContainer()) if (pDocShell->GetWrtShell())
{ {
auto pWrtShell = dynamic_cast<SwWrtShell*>(&rShell); for (SwViewShell& rShell : pDocShell->GetWrtShell()->GetRingContainer())
if (!pWrtShell || pWrtShell == pDocShell->GetWrtShell()) {
continue; auto pWrtShell = dynamic_cast<SwWrtShell*>(&rShell);
if (!pWrtShell || pWrtShell == pDocShell->GetWrtShell())
continue;
SwShellCursor* pCursor = pWrtShell->GetCursor_(); SwShellCursor* pCursor = pWrtShell->GetCursor_();
if (!pCursor) if (!pCursor)
continue; continue;
SwIndex& rIndex = const_cast<SwIndex&>(pCursor->Start()->nContent); SwIndex& rIndex = const_cast<SwIndex&>(pCursor->Start()->nContent);
if (&pCursor->Start()->nNode.GetNode() == this && rIndex.GetIndex() == rPos.GetIndex()) if (&pCursor->Start()->nNode.GetNode() == this && rIndex.GetIndex() == rPos.GetIndex())
{ {
// The cursor position of this other shell is exactly our insert position. // The cursor position of this other shell is exactly our insert position.
rIndex.Assign(&aTmpIdxReg, rIndex.GetIndex()); rIndex.Assign(&aTmpIdxReg, rIndex.GetIndex());
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment