diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2015-04-18 23:13:51 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-04-20 10:26:57 +0000 |
commit | ec485dc13bd16a3a9c168758cd742fe38e78b482 (patch) | |
tree | cb5457b0a581602f52090c044529c9945c5aa1d0 | |
parent | 6adab4507858fc1606c8e426151d3d8ec6353bd0 (diff) |
tdf#55502: Shell BASIC function with empty third param hangs
bt:
2 0x00002aaaab2b5226 in __assert_fail_base (fmt=0x2aaaab3ebce8 "%s%s%s:%u: %s%sAssertion `%s' failed.
%n",
assertion=assertion@entry=0x2aaaae2ecf10 "index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength())",
file=file@entry=0x2aaaae2ecec8 "/home/julien/compile-libreoffice/libreoffice/include/rtl/ustring.hxx", line=line@entry=500,
function=function@entry=0x2aaaae2ed740 <rtl::OUString::operator[](int) const::__PRETTY_FUNCTION__> "sal_Unicode rtl::OUString::operator[](sal_Int32) const") at assert.c:92
3 0x00002aaaab2b52d2 in __GI___assert_fail (assertion=0x2aaaae2ecf10 "index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength())",
file=0x2aaaae2ecec8 "/home/julien/compile-libreoffice/libreoffice/include/rtl/ustring.hxx", line=500,
function=0x2aaaae2ed740 <rtl::OUString::operator[](int) const::__PRETTY_FUNCTION__> "sal_Unicode rtl::OUString::operator[](sal_Int32) const") at assert.c:101
4 0x00002aaaae1f44f8 in rtl::OUString::operator[] (this=0x7fffffff36b0, index=13) at /home/julien/compile-libreoffice/libreoffice/include/rtl/ustring.hxx:500
5 0x00002aaaae274036 in SbRtl_Shell (pBasic=0x3531fc0, rPar=..., bWrite=false) at /home/julien/compile-libreoffice/libreoffice/basic/source/runtime/methods.cxx:3613
Check if third param isn't empty, if not, aCmdLine finishes with a space character
Change-Id: I095b6dc7c7d2d4c826fb47aa1414c558bbc27c04
Reviewed-on: https://gerrit.libreoffice.org/15380
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | basic/source/runtime/methods.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 51df75b74bd2..545e39651c1f 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -3590,8 +3590,12 @@ RTLFUNC(Shell) // attach additional parameters - everything must be parsed anyway if( nArgCount >= 4 ) { - aCmdLine += " "; - aCmdLine += rPar.Get(3)->GetOUString(); + OUString tmp = rPar.Get(3)->GetOUString().trim(); + if (!tmp.isEmpty()) + { + aCmdLine += " "; + aCmdLine += tmp; + } } else if( aCmdLine.isEmpty() ) { |