summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2018-02-13 20:54:05 -0400
committerHenry Castro <hcastro@collabora.com>2018-02-14 12:41:39 +0100
commit9763383ebb7e5b10ba9e7557dffa803a8d392c0d (patch)
treedf1f42c2e832a908ac956f38ca0d5f169d66612b /desktop/source
parenta8af8b792eb653cab807c07b7d9f6ec40b789418 (diff)
lok: check if an element exists in the container
Change-Id: I5987e90d92a2ebff654a993fb77e389bd036a8f8 Reviewed-on: https://gerrit.libreoffice.org/49693 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/lib/init.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f5952665d148..bc788d243b9e 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2850,11 +2850,12 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
OUString sName;
bool bIsPhysical;
boost::property_tree::ptree aChild;
- uno::Reference<beans::XPropertySet> xProperty;
boost::property_tree::ptree aChildren;
+ const OUString sPageStyles("PageStyles");
+ uno::Reference<beans::XPropertySet> xProperty;
uno::Reference<container::XNameContainer> xContainer;
- if (xStyleFamilies->getByName("PageStyles") >>= xContainer)
+ if (xStyleFamilies->hasByName(sPageStyles) && (xStyleFamilies->getByName(sPageStyles) >>= xContainer))
{
uno::Sequence<OUString> aSeqNames = xContainer->getElementNames();
for (sal_Int32 itName = 0; itName < aSeqNames.getLength(); itName++)