sd theme: fix applying new colors after theme change for group shapes
UpdateSdrObject() is called for both group and non-group shapes, so don't assume that they always have text, otherwise we would crash. Change-Id: I3672673176f0cb462a8b8d61a68466f541e9ce06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128248 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
This commit is contained in:
Binary file not shown.
@@ -68,6 +68,7 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
|
||||
OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "theme.pptx";
|
||||
getComponent() = loadFromDesktop(aURL);
|
||||
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
|
||||
// The draw page also contains a group shape to make sure we don't crash on group shapes.
|
||||
uno::Reference<drawing::XMasterPageTarget> xDrawPage(
|
||||
xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
|
||||
uno::Reference<drawing::XShapes> xDrawPageShapes(xDrawPage, uno::UNO_QUERY);
|
||||
|
@@ -74,6 +74,12 @@ void UpdateSdrObject(svx::Theme* pTheme, SdrObject* pObject)
|
||||
}
|
||||
|
||||
uno::Reference<text::XTextRange> xShape(pObject->getUnoShape(), uno::UNO_QUERY);
|
||||
if (!xShape.is())
|
||||
{
|
||||
// E.g. group shapes have no text.
|
||||
return;
|
||||
}
|
||||
|
||||
uno::Reference<container::XEnumerationAccess> xText(xShape->getText(), uno::UNO_QUERY);
|
||||
uno::Reference<container::XEnumeration> xParagraphs = xText->createEnumeration();
|
||||
while (xParagraphs->hasMoreElements())
|
||||
|
Reference in New Issue
Block a user