summaryrefslogtreecommitdiff
path: root/sc/source/ui/vba/vbarange.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-03-02 15:40:34 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-03-02 20:08:21 +0000
commitb2a2404ef0dcfbda15e26d4dfd7397d96279bcde (patch)
treea27021aec475cdb16672225a390eb75556884c1e /sc/source/ui/vba/vbarange.cxx
parent7c8d2e2b6da71ba829b3f566b764715c79f989a3 (diff)
coverity#735816 Dereference after null check
Change-Id: Idbaa44d70e2ed297da1e54d1eb33b8d23db184e1
Diffstat (limited to 'sc/source/ui/vba/vbarange.cxx')
-rw-r--r--sc/source/ui/vba/vbarange.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index ef2ab649d17b..648d23400c63 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -2885,7 +2885,10 @@ ScVbaRange::PasteSpecial( const uno::Any& Paste, const uno::Any& Operation, cons
throw uno::RuntimeException("That command cannot be used on multiple selections", uno::Reference< uno::XInterface >() );
ScDocShell* pShell = getScDocShell();
- uno::Reference< frame::XModel > xModel( ( pShell ? pShell->GetModel() : NULL ), uno::UNO_QUERY_THROW );
+ if (!pShell)
+ throw uno::RuntimeException("That command cannot be used with no ScDocShell", uno::Reference< uno::XInterface >() );
+
+ uno::Reference< frame::XModel > xModel(pShell->GetModel(), uno::UNO_QUERY_THROW);
uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
// select this range
xSelection->select( uno::makeAny( mxRange ) );