summaryrefslogtreecommitdiff
path: root/sw/source/uibase/utlui
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2024-04-25 10:12:41 +0200
committerVasily Melenchuk <vasily.melenchuk@cib.de>2024-04-29 12:06:00 +0200
commit084882a66c4e612f207024be301631102be31ca6 (patch)
tree3584926b16cf2128c62fa5d3bb88ac0bae59b23c /sw/source/uibase/utlui
parent5a61b590ae51ccf28e501bb943f1cf4a3e9835a1 (diff)
sw: fixed crash on GetCreateView() returning nullptr
Change-Id: Id0cb44ac7d805a1736fa8170aaffb97b54211707 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166617 Tested-by: Jenkins Reviewed-by: Vasily Melenchuk <vasily.melenchuk@cib.de>
Diffstat (limited to 'sw/source/uibase/utlui')
-rw-r--r--sw/source/uibase/utlui/navipi.cxx21
1 files changed, 13 insertions, 8 deletions
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index bb8338e3fe9e..e86e51c30d11 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -73,6 +73,8 @@ OUString SwNavigationPI::CleanEntry(const OUString& rEntry)
void SwNavigationPI::MoveOutline(SwOutlineNodes::size_type nSource, SwOutlineNodes::size_type nTarget)
{
SwView *pView = GetCreateView();
+ if (!pView)
+ return;
SwWrtShell &rSh = pView->GetWrtShell();
if(nTarget < nSource || nTarget == SwOutlineNodes::npos)
nTarget ++;
@@ -575,7 +577,7 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent,
//Open Headings by default
SwView *pView = GetCreateView();
- if (pView->m_nNaviExpandedStatus < 0)
+ if (pView && pView->m_nNaviExpandedStatus < 0)
{
pView->m_nNaviExpandedStatus = 1;
m_xContentTree->ExpandAllHeadings();
@@ -684,13 +686,16 @@ void SwNavigationPI::NotifyItemUpdate(sal_uInt16 nSID, SfxItemState /*eState*/,
if (SwView::GetMoveType() == NID_PGE)
{
SwView *pView = GetCreateView();
- SwWrtShell &rSh = pView->GetWrtShell();
- // GetPageNum - return current page number:
- // true: in which cursor is located.
- // false: which is visible at the upper margin.
- sal_uInt16 nPhyNum, nVirtNum;
- rSh.GetPageNum(nPhyNum, nVirtNum, false);
- m_xGotoPageSpinButton->set_text(OUString::number(nPhyNum));
+ if (pView)
+ {
+ SwWrtShell& rSh = pView->GetWrtShell();
+ // GetPageNum - return current page number:
+ // true: in which cursor is located.
+ // false: which is visible at the upper margin.
+ sal_uInt16 nPhyNum, nVirtNum;
+ rSh.GetPageNum(nPhyNum, nVirtNum, false);
+ m_xGotoPageSpinButton->set_text(OUString::number(nPhyNum));
+ }
}
}
}