summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basic/source/runtime/step1.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index b5dbc3310084..483d912107be 100644
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -144,15 +144,19 @@ void SbiRuntime::StepARGTYP( sal_uInt32 nOp1 )
void SbiRuntime::StepPAD( sal_uInt32 nOp1 )
{
SbxVariable* p = GetTOS();
- String& s = (String&)(const String&) *p;
- if (s.Len() != nOp1)
+ OUString s = p->GetOUString();
+ sal_Int32 nLen(nOp1);
+ if( s.getLength() != nLen )
{
rtl::OUStringBuffer aBuf(s);
- sal_Int32 nLen(nOp1);
if (aBuf.getLength() > nLen)
+ {
comphelper::string::truncateToLength(aBuf, nLen);
+ }
else
+ {
comphelper::string::padToLength(aBuf, nLen, ' ');
+ }
s = aBuf.makeStringAndClear();
}
}