diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index efa055adea92..bdda55ea7b7d 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -270,7 +270,8 @@ void DesktopLOKTest::testGetStyles() void DesktopLOKTest::testGetFonts() { - LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); + comphelper::LibreOfficeKit::setActive(); + LibLODocument_Impl* pDocument = loadDoc("blank_presentation.odp"); boost::property_tree::ptree aTree; char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:CharFontName"); std::stringstream aStream(pJSON); @@ -285,6 +286,8 @@ void DesktopLOKTest::testGetFonts() // check that we have font sizes available for each font CPPUNIT_ASSERT( rPair.second.size() > 0); } + free(pJSON); + comphelper::LibreOfficeKit::setActive(false); } void DesktopLOKTest::testCreateView() diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index c6c4f4f6bb34..01aa8419b67c 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -74,9 +74,19 @@ int OutputDevice::GetDevFontCount() const if( !mpDeviceFontList ) { if (!mpFontCollection) + { return 0; + } mpDeviceFontList = mpFontCollection->GetDeviceFontList(); + + if (!mpDeviceFontList->Count()) + { + delete mpDeviceFontList; + mpDeviceFontList = nullptr; + + return 0; + } } return mpDeviceFontList->Count(); }