diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-12-16 12:11:38 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-12-16 21:17:15 +0000 |
commit | 1726c27e0d633ab04843834d2bf987bc7645807f (patch) | |
tree | 7810a18cd5bc3bf5aa345b816b372d93bd323974 /sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx | |
parent | 1ae71d8f09771ba7180be6ebdf89d36a31eb8625 (diff) |
check SfxObjectShell::Current()
SfxObjectShell::Current() can return null, it's based on the equally
vile SfxViewFrame::Current()
Change-Id: Ia5c7783680e9d8e5d3075078f16a2c15cb6f7a47
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144339
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx')
-rw-r--r-- | sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx index d7772596df70..518b61d8f1a1 100644 --- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx +++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx @@ -419,15 +419,17 @@ static void MetadataToTreeNode(const css::uno::Reference<css::uno::XInterface>& // list associated (predicate, object) pairs of the actual subject // under the tree node "Metadata Reference" - SwDocShell* pDocSh = static_cast<SwDocShell*>(SfxObjectShell::Current()); - uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(pDocSh->GetBaseModel(), - uno::UNO_QUERY); - const uno::Reference<rdf::XRepository>& xRepo = xDocumentMetadataAccess->getRDFRepository(); - const css::uno::Reference<css::rdf::XResource> xSubject(rSource, uno::UNO_QUERY); - std::map<OUString, OUString> xStatements - = SwRDFHelper::getStatements(pDocSh->GetBaseModel(), xRepo->getGraphNames(), xSubject); - for (const auto& pair : xStatements) - aCurNode.children.push_back(SimplePropToTreeNode(pair.first, uno::Any(pair.second))); + if (SwDocShell* pDocSh = static_cast<SwDocShell*>(SfxObjectShell::Current())) + { + uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(pDocSh->GetBaseModel(), + uno::UNO_QUERY); + const uno::Reference<rdf::XRepository>& xRepo = xDocumentMetadataAccess->getRDFRepository(); + const css::uno::Reference<css::rdf::XResource> xSubject(rSource, uno::UNO_QUERY); + std::map<OUString, OUString> xStatements + = SwRDFHelper::getStatements(pDocSh->GetBaseModel(), xRepo->getGraphNames(), xSubject); + for (const auto& pair : xStatements) + aCurNode.children.push_back(SimplePropToTreeNode(pair.first, uno::Any(pair.second))); + } rNode.children.push_back(aCurNode); } |