sd/source/ui/sidebar/DocumentHelper.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
New commits: commit 41e180f500a42a3afd53b673f538becd75a8f120 Author: Jim Raykowski <[email protected]> AuthorDate: Thu Jul 16 13:25:47 2020 -0800 Commit: Xisco Fauli <[email protected]> CommitDate: Mon Aug 10 11:31:25 2020 +0200 tdf#134847 fix nullptr use crash Grabbing focus back to the document when OLE object last had focus sets focus to the frame containing the OLE object. sd::ViewShell is no good in this case and crashes when undo manager tries to pass ViewShellId to EnterListAction. Other areas in the code set ViewShellId(-1) and then check if ViewShell is good before getting ViewShellId. This patch follows these practices. Change-Id: I89093686c4d98148ac032832711f80479366741d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99759 Tested-by: Jenkins Reviewed-by: Jim Raykowski <[email protected]> (cherry picked from commit f52f86a3905fc099832187ad20fd29f0ab73b43f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100226 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx b/sd/source/ui/sidebar/DocumentHelper.cxx index 151cc510622e..08fab9f247d3 100644 --- a/sd/source/ui/sidebar/DocumentHelper.cxx +++ b/sd/source/ui/sidebar/DocumentHelper.cxx @@ -312,9 +312,12 @@ void DocumentHelper::AssignMasterPageToPageList ( if (aCleanedList.empty() ) return; + ViewShellId nViewShellId(-1); + if (sd::ViewShell* pViewShell = rTargetDocument.GetDocSh()->GetViewShell()) + nViewShellId = pViewShell->GetViewShellBase().GetViewShellId(); SfxUndoManager* pUndoMgr = rTargetDocument.GetDocSh()->GetUndoManager(); if( pUndoMgr ) - pUndoMgr->EnterListAction(SdResId(STR_UNDO_SET_PRESLAYOUT), OUString(), 0, rTargetDocument.GetDocSh()->GetViewShell()->GetViewShellBase().GetViewShellId()); + pUndoMgr->EnterListAction(SdResId(STR_UNDO_SET_PRESLAYOUT), OUString(), 0, nViewShellId); SdPage* pMasterPageInDocument = ProvideMasterPage(rTargetDocument,pMasterPage,rpPageList); if (pMasterPageInDocument == nullptr) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
