summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-02-10 10:26:04 +0000
committerMichael Stahl <mstahl@redhat.com>2014-04-09 11:47:03 +0000
commit609e949bfe407487f417fadb377ead3a3a9cfa5c (patch)
treef0f4e0ed54cebe1687a6c66b38e979b352349d41
parent2574c41e755bf2287e3db756b5aeafb2d133cada (diff)
Resolves: fdo#77174 crash with "New style from selection" with List
was coverity#1130423 Dereference null return value (cherry picked from commit a434a8bfdd8b9323c8262edcd591641fe9ea8b19) Change-Id: If6981a9654a114e34dad931381ea071d5169adc2 Reviewed-on: https://gerrit.libreoffice.org/8905 Tested-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/source/ui/app/docst.cxx22
1 files changed, 13 insertions, 9 deletions
diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
index 30ed690933d8..ff0a01fb3729 100644
--- a/sw/source/ui/app/docst.cxx
+++ b/sw/source/ui/app/docst.cxx
@@ -1168,19 +1168,23 @@ sal_uInt16 SwDocShell::MakeByExample( const OUString &rName, sal_uInt16 nFamily,
case SFX_STYLE_FAMILY_PSEUDO:
{
- pCurrWrtShell->StartAllAction();
+ const SwNumRule* pCurRule = pCurrWrtShell->GetCurNumRule();
- SwNumRule aRule( *pCurrWrtShell->GetCurNumRule() );
- OUString sOrigRule( aRule.GetName() );
- // #i91400#
- aRule.SetName( pStyle->GetNumRule()->GetName(),
- *(pCurrWrtShell->GetDoc()) );
- pCurrWrtShell->ChgNumRuleFmts( aRule );
+ if (pCurRule)
+ {
+ pCurrWrtShell->StartAllAction();
- pCurrWrtShell->ReplaceNumRule( sOrigRule, aRule.GetName() );
+ SwNumRule aRule( *pCurRule );
+ OUString sOrigRule( aRule.GetName() );
+ // #i91400#
+ aRule.SetName( pStyle->GetNumRule()->GetName(),
+ *(pCurrWrtShell->GetDoc()) );
+ pCurrWrtShell->ChgNumRuleFmts( aRule );
+ pCurrWrtShell->ReplaceNumRule( sOrigRule, aRule.GetName() );
- pCurrWrtShell->EndAllAction();
+ pCurrWrtShell->EndAllAction();
+ }
}
break;
}