summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorKevin Suo <suokunlong@126.com>2022-11-10 10:19:08 +0800
committerMike Kaganski <mike.kaganski@collabora.com>2022-11-11 08:30:29 +0100
commit9b80b2d6140d1aad240f10755105e49d678b98f1 (patch)
tree78f2223de538a5938cb214da4b30e991a95dbcda /sw
parent079adbadf57a1c31384aa676aa514522b0fa58b1 (diff)
tdf#151979: fix crash in Text Grid dialog when switching active view
GetActiveView() may return a nullptr when previously we are in Calc window and then click the controls on the writer dialog. Change-Id: Ia4dcd58b19c40a3e6cd0a791b7645d5fd2dcb9f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142508 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/misc/pggrid.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 95f7116670b9..545694643b81 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -152,10 +152,13 @@ bool SwTextGridPage::FillItemSet(SfxItemSet *rSet)
// draw ticks of ruler
SwView * pView = ::GetActiveView();
- if ( m_bHRulerChanged )
- pView->GetHRuler().DrawTicks();
- if ( m_bVRulerChanged )
- pView->GetVRuler().DrawTicks();
+ if (pView)
+ {
+ if ( m_bHRulerChanged )
+ pView->GetHRuler().DrawTicks();
+ if ( m_bVRulerChanged )
+ pView->GetVRuler().DrawTicks();
+ }
return bRet;
}
@@ -247,7 +250,7 @@ void SwTextGridPage::PutGridItem(SfxItemSet& rSet)
rSet.Put(aGridItem);
SwView * pView = ::GetActiveView();
- if ( aGridItem.GetGridType() != GRID_NONE )
+ if (pView && aGridItem.GetGridType() != GRID_NONE)
{
if ( aGridItem.GetGridType() == GRID_LINES_CHARS )
{