summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-06-20 17:22:50 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-06-20 17:22:50 +0200
commit12a4b8122227ca0527c282842fe30fa73a390500 (patch)
tree7f567193b8a6592ee98954abbdc70c7c3c8244f6 /sfx2
parent23d8fd8dcde97e3e60ebcc75d05d9b39d3bc5a30 (diff)
Missing null check
As Kendy found out, "In Writer: Enable the drawing functions [view -> toolbars -> drawing], choose 'Line Callout 1' among the presets Callouts [to the left from the stars], and attempt to click and drag in the document to insert it" triggers assert in SvRef<T>::operator* introduced in 160ae9889e4d16217a7cca7d930f776f5a645ec8 "Catch illegal null pointer dereferences early." Given how most places in sfx2/source/doc/sfxbasemodel.cxx already check for null m_pObjectShell, looks like this had just been missing here, and the SfxDocInfoListener_Impl's modified has probably never been called, so it went unnoticed that its m_rShell was a "null reference." Change-Id: I6b6dad831938d5fa89340895b98797686b60c5cc
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 15a76db3d78d..19dd94c889bd 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -821,9 +821,12 @@ IMPL_SfxBaseModel_DataContainer::impl_setDocumentProperties(
const Reference< document::XDocumentProperties >& rxNewDocProps)
{
m_xDocumentProperties.set(rxNewDocProps, UNO_QUERY_THROW);
- Reference<util::XModifyBroadcaster> const xMB(m_xDocumentProperties,
- UNO_QUERY_THROW);
- xMB->addModifyListener(new SfxDocInfoListener_Impl(*m_pObjectShell));
+ if (m_pObjectShell.Is())
+ {
+ Reference<util::XModifyBroadcaster> const xMB(
+ m_xDocumentProperties, UNO_QUERY_THROW);
+ xMB->addModifyListener(new SfxDocInfoListener_Impl(*m_pObjectShell));
+ }
}
// document::XDocumentPropertiesSupplier: