summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-05 15:53:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-05 21:58:08 +0200
commitbf4b2e9f1ef51731299714119361f6e5f73d9072 (patch)
tree33fbbaf7f04c19fe69d8856359e64a5ca42ddd45
parent3f009ab4e767000da299fe222184efea29942173 (diff)
cid#1448260 Argument cannot be negative
Change-Id: I147f68c04c8905aac9e790766c260a30cc061d92 Reviewed-on: https://gerrit.libreoffice.org/75141 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/source/ui/vba/vbafiledialogitems.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/sc/source/ui/vba/vbafiledialogitems.cxx b/sc/source/ui/vba/vbafiledialogitems.cxx
index 8c0210c70fdc..551da71fda3e 100644
--- a/sc/source/ui/vba/vbafiledialogitems.cxx
+++ b/sc/source/ui/vba/vbafiledialogitems.cxx
@@ -67,7 +67,10 @@ uno::Any
ScVbaFileDialogSelectedItems::createCollectionObject( const uno::Any& aSource )
{
sal_Int32 nPosition = -1;
- aSource >>= nPosition;
+ if (!(aSource >>= nPosition))
+ throw uno::RuntimeException("not an sal_Int32");
+ if (nPosition < 0 || nPosition >= static_cast<sal_Int32>(m_sItems.size()))
+ throw uno::RuntimeException("out of range");
OUString sPath = m_sItems[nPosition];
return uno::makeAny( sPath );