summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2020-11-18 21:56:25 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-19 10:17:42 +0100
commitacf7d8d1ab6fe6ad0fb8a5d1ad2d2ef53f578757 (patch)
treebe0cd861828b79b1cfa77e46f5204ffc1420cf0b /xmloff
parent2cf83fe6051ba7e1b6cb66a4bd71a15f0bd0ad27 (diff)
Avoid wrong warning in OElementImport::implApplyGenericProperties (xmloff)
When empty sequence, there's nothing to convert so no need to spend time here and to indicate the following warning: Avoid warn:legacy.osl:93722:93722:xmloff/source/forms/elementimport.cxx:364: OElementImport::implApplyGenericProperties: conversion to sequences other than 'sequence< short >' not implemented, yet! + avoid these in the same time: warn:xmloff.forms:88800:88800:xmloff/source/forms/elementimport.cxx:428: DBG_UNHANDLED_EXCEPTION in implApplyGenericProperties exception: com.sun.star.lang.IllegalArgumentException message: /home/julien/lo/libreoffice/include/cppuhelper/proptypehlp.hxx:35 ArgumentPosition: 0 In addition, convert 2 OSL_ENSURE of this block in SAL_WARN_IF Change-Id: I047eb5afba6fd22249010791aa61ebd1f83f3c67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106082 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/forms/elementimport.cxx15
1 files changed, 10 insertions, 5 deletions
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 1fac083e463c..42a151c9354b 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -356,16 +356,21 @@ namespace xmloff
if ( bValueIsSequence )
{
- OSL_ENSURE( eValueTypeClass == TypeClass_ANY,
+ Sequence< Any > aXMLValueList;
+ rPropValues.Value >>= aXMLValueList;
+ // just skip this part if empty sequence
+ if (!aXMLValueList.getLength())
+ continue;
+
+ Sequence< sal_Int16 > aPropertyValueList( aXMLValueList.getLength() );
+
+ SAL_WARN_IF( eValueTypeClass != TypeClass_ANY, "xmloff",
"OElementImport::implApplyGenericProperties: only ANYs should have been imported as generic list property!" );
// (OPropertyImport should produce only Sequencer< Any >, since it cannot know the real type
- OSL_ENSURE( ePropTypeClass == TypeClass_SHORT,
+ SAL_WARN_IF( ePropTypeClass != TypeClass_SHORT, "xmloff",
"OElementImport::implApplyGenericProperties: conversion to sequences other than 'sequence< short >' not implemented, yet!" );
- Sequence< Any > aXMLValueList;
- rPropValues.Value >>= aXMLValueList;
- Sequence< sal_Int16 > aPropertyValueList( aXMLValueList.getLength() );
std::transform(aXMLValueList.begin(), aXMLValueList.end(), aPropertyValueList.begin(),
[](const Any& rXMLValue) -> sal_Int16 {