summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-12-09 09:57:11 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-12-09 15:21:32 +0100
commita0f44c862d06981d5ae2625f0a8032e40ce76c4d (patch)
treeac642726eac9e6d0448b7942ee5a110d1fa0febd /writerfilter/source/dmapper
parent6e0f18d7d523c62236a1968c36b4e0cc8586ac34 (diff)
negative return passed to parameter that cannot be negative
I wonder if the test != 0 is what was really intended here, but keep that legacy logic anyway Change-Id: I4b39a2130e961c6f2ca97695e4625df5a95e00b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107460 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'writerfilter/source/dmapper')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 3e50c10ee4b4..8b030cf860f4 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -79,6 +79,7 @@
#include <com/sun/star/document/XFilter.hpp>
#include <editeng/flditem.hxx>
#include <editeng/unotext.hxx>
+#include <o3tl/safeint.hxx>
#include <o3tl/temporary.hxx>
#include <oox/mathml/import.hxx>
#include <xmloff/odffields.hxx>
@@ -157,7 +158,7 @@ static void lcl_handleDropdownField( const uno::Reference< beans::XPropertySet >
rxFieldProps->setPropertyValue( "Items", uno::makeAny( sItems ) );
sal_Int32 nResult = pFFDataHandler->getDropDownResult().toInt32();
- if ( nResult )
+ if (nResult > 0 && o3tl::make_unsigned(nResult) < sItems.size())
rxFieldProps->setPropertyValue( "SelectedItem", uno::makeAny( sItems[ nResult ] ) );
if ( !pFFDataHandler->getHelpText().isEmpty() )
rxFieldProps->setPropertyValue( "Help", uno::makeAny( pFFDataHandler->getHelpText() ) );