summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-10-28 19:55:57 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-10-28 21:39:37 +0100
commit10e8f11eb7936a5bc0c5d319112e40f2a2d887a0 (patch)
tree4fef1865b5d0fedf97c9d20b131a425f0a2f999f /sc
parentded55489b2d6a66fc2a494c492cbc4e140b19bde (diff)
fix another assertion related to string length in calc functions
Change-Id: I6ef2091c9c5aea500b3af1b78acc954cd892acad
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr1.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 3c411008a40d..ad1e72000645 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -7798,7 +7798,7 @@ void ScInterpreter::ScLeft()
sal_uInt8 nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 1, 2 ) )
{
- xub_StrLen n;
+ sal_Int32 n;
if (nParamCount == 2)
{
double nVal = ::rtl::math::approxFloor(GetDouble());
@@ -7808,11 +7808,12 @@ void ScInterpreter::ScLeft()
return ;
}
else
- n = (xub_StrLen) nVal;
+ n = (sal_Int32) nVal;
}
else
n = 1;
OUString aStr = GetString().getString();
+ n = std::min(n, aStr.getLength());
aStr = aStr.copy( 0, n );
PushString( aStr );
}