diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2018-12-07 11:10:14 +0100 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-12-10 10:15:28 +0100 |
commit | 86abd3ec30bac181df228569b70aaf9086ed5f4a (patch) | |
tree | a69629395a0f934b39b48c2410a031be97459876 /sd | |
parent | b2583abd214467c40c4ca2d9e6e6168bf6160aa8 (diff) |
Check pDoc is not null
Change-Id: I9a85e6ee0b1d2df36999cbd968d84bf60e62f0a9
Reviewed-on: https://gerrit.libreoffice.org/64758
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/sidebar/SlideBackground.cxx | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx index e1958c1927ad..d1c7bdcdb8ef 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -157,19 +157,22 @@ SlideBackground::SlideBackground( ::sd::DrawDocShell* pDocSh = dynamic_cast<::sd::DrawDocShell*>( SfxObjectShell::Current() ); SdDrawDocument* pDoc = pDocSh ? pDocSh->GetDoc() : nullptr; - SdOptions* pOptions = SD_MOD()->GetSdOptions(pDoc->GetDocumentType()); - if (pOptions) + if (pDoc) { - FieldUnit eMetric = static_cast<FieldUnit>(pOptions->GetMetric()); - if (IsInch(eMetric)) + SdOptions* pOptions = SD_MOD()->GetSdOptions(pDoc->GetDocumentType()); + if (pOptions) { - for (size_t i = 0; i < SAL_N_ELEMENTS(RID_PAGEFORMATPANEL_MARGINS_INCH); ++i) - mpMarginSelectBox->InsertEntry(SdResId(RID_PAGEFORMATPANEL_MARGINS_INCH[i])); + FieldUnit eMetric = static_cast<FieldUnit>(pOptions->GetMetric()); + if (IsInch(eMetric)) + { + for (size_t i = 0; i < SAL_N_ELEMENTS(RID_PAGEFORMATPANEL_MARGINS_INCH); ++i) + mpMarginSelectBox->InsertEntry(SdResId(RID_PAGEFORMATPANEL_MARGINS_INCH[i])); + } + else + { + for (size_t i = 0; i < SAL_N_ELEMENTS(RID_PAGEFORMATPANEL_MARGINS_CM); ++i) + mpMarginSelectBox->InsertEntry(SdResId(RID_PAGEFORMATPANEL_MARGINS_CM[i])); } - else - { - for (size_t i = 0; i < SAL_N_ELEMENTS(RID_PAGEFORMATPANEL_MARGINS_CM); ++i) - mpMarginSelectBox->InsertEntry(SdResId(RID_PAGEFORMATPANEL_MARGINS_CM[i])); } } |