[Libreoffice-commits] core.git: writerfilter/source
Mike Kaganski
mike.kaganski at collabora.com
Tue May 9 06:54:48 UTC 2017
writerfilter/source/dmapper/GraphicHelpers.cxx | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
New commits:
commit f66b76a4d20719e4c13bd755c49f8140a0e72816
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date: Mon May 8 16:42:55 2017 +0300
tdf#105688: findZOrder: catch exceptions from getPropertyValue
For some reason, sometimes items in GraphicZOrderHelper don't
have ZOrder property value, and so throw in getPropertyValue.
E.g., SwXFrame::getPropertyValue throws uno::RuntimeException
when its GetFrameFormat() returns nullptr.
The patch catches these to allow to proceed with fallback z-order.
Change-Id: I96140195f45364bccee7c5547d373158e2b49154
Reviewed-on: https://gerrit.libreoffice.org/37392
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx b/writerfilter/source/dmapper/GraphicHelpers.cxx
index 2ae112af294b..c970f8999cc0 100644
--- a/writerfilter/source/dmapper/GraphicHelpers.cxx
+++ b/writerfilter/source/dmapper/GraphicHelpers.cxx
@@ -273,20 +273,23 @@ sal_Int32 GraphicZOrderHelper::findZOrder( sal_Int32 relativeHeight, bool bOldSt
else
++it;
}
+ sal_Int32 itemZOrderOffset(0); // before the item
if( it == items.end()) // we're topmost
{
if( items.empty())
return 0;
- sal_Int32 itemZOrder(0);
--it;
- if( it->second->getPropertyValue(getPropertyName( PROP_Z_ORDER )) >>= itemZOrder )
- return itemZOrder + 1; // after the topmost
+ itemZOrderOffset = 1; // after the topmost
}
- else
- {
+ // SwXFrame::getPropertyValue throws uno::RuntimeException
+ // when its GetFrameFormat() returns nullptr
+ try {
sal_Int32 itemZOrder(0);
if( it->second->getPropertyValue(getPropertyName( PROP_Z_ORDER )) >>= itemZOrder )
- return itemZOrder; // before the item
+ return itemZOrder + itemZOrderOffset;
+ }
+ catch (const uno::RuntimeException&) {
+ SAL_WARN("writerfilter", "Exception when getting item z-order");
}
SAL_WARN( "writerfilter", "findZOrder() didn't find item z-order" );
return 0; // this should not(?) happen
More information about the Libreoffice-commits
mailing list