summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/uiview/pview.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 47136c11bfb6..20fff299cf5e 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -1136,8 +1136,8 @@ void SwPagePreview::Init()
// Update the fields
// ATTENTION: Do cast the EditShell up, to use the SS.
// At the methodes the current shell will be queried!
- SwEditShell* pESh = static_cast<SwEditShell*>(GetViewShell());
- bool bIsModified = pESh->IsModified();
+ SwEditShell* pESh = dynamic_cast<SwEditShell*>(GetViewShell());
+ bool bIsModified = pESh != nullptr && pESh->IsModified();
SwViewOption aOpt( *pPrefs );
aOpt.SetPagePreview(true);
@@ -1172,7 +1172,7 @@ void SwPagePreview::Init()
GetViewShell()->CalcLayout();
DocSzChgd( GetViewShell()->GetDocSize() );
- if( !bIsModified )
+ if( !bIsModified && pESh != nullptr )
pESh->ResetModified();
}