diff options
Diffstat (limited to 'basic/source/classes')
-rw-r--r-- | basic/source/classes/sb.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 570447246cf9..4e3e716a56ca 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -18,6 +18,7 @@ */ #include <sb.hxx> +#include <o3tl/safeint.hxx> #include <rtl/ustrbuf.hxx> #include <tools/stream.hxx> #include <tools/debug.hxx> @@ -2172,7 +2173,7 @@ void BasicCollection::CollItem( SbxArray* pPar_ ) SbxVariable* pRes = nullptr; SbxVariable* p = pPar_->Get(1); sal_Int32 nIndex = implGetIndex( p ); - if (nIndex >= 0 && nIndex < static_cast<sal_Int32>(xItemArray->Count())) + if (nIndex >= 0 && o3tl::make_unsigned(nIndex) < xItemArray->Count()) { pRes = xItemArray->Get(nIndex); } @@ -2196,7 +2197,7 @@ void BasicCollection::CollRemove( SbxArray* pPar_ ) SbxVariable* p = pPar_->Get(1); sal_Int32 nIndex = implGetIndex( p ); - if (nIndex >= 0 && nIndex < static_cast<sal_Int32>(xItemArray->Count())) + if (nIndex >= 0 && o3tl::make_unsigned(nIndex) < xItemArray->Count()) { xItemArray->Remove( nIndex ); |