summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2024-09-27 08:52:57 +0200
committerMiklos Vajna <vmiklos@collabora.com>2024-10-02 13:09:04 +0200
commitd5d7883fdecfb2c98c880ee2e957a1e34cba45bf (patch)
tree68692fed91fdb778eee06218b0288335bfddf782 /desktop/source
parent0e23cabf2fd00f50e221f4eea7f19ceadc65fd54 (diff)
desktop lok: fix crash in getStyles()
Crashreport backtrace: > program/libmergedlo.so > getStyles > desktop/source/lib/init.cxx:6411 > program/libmergedlo.so > doc_getCommandValues > desktop/source/lib/init.cxx:6666 Which is probably a call on an already disposed document. Fix it similar to how getFonts() does it. Change-Id: I1744bd04b7ebdea1b69ca121b8cfa47314d67528 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174372 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/lib/init.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d8d217d571ae..043bc769450e 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -6413,6 +6413,10 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
aTree.put("commandName", pCommand);
uno::Reference<css::style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(pDocument->mxComponent, uno::UNO_QUERY);
const uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies();
+ if (!xStyleFamilies.is())
+ {
+ return nullptr;
+ }
const uno::Sequence<OUString> aStyleFamilies = xStyleFamilies->getElementNames();
static constexpr OUString aWriterStyles[] =