From 41392516ca0fc099c383c4319923b895ecc16be6 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 18 Apr 2015 23:13:51 +0200 Subject: 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(index) < static_cast(getLength())", file=file@entry=0x2aaaae2ecec8 "/home/julien/compile-libreoffice/libreoffice/include/rtl/ustring.hxx", line=line@entry=500, function=function@entry=0x2aaaae2ed740 "sal_Unicode rtl::OUString::operator[](sal_Int32) const") at assert.c:92 3 0x00002aaaab2b52d2 in __GI___assert_fail (assertion=0x2aaaae2ecf10 "index >= 0 && static_cast(index) < static_cast(getLength())", file=0x2aaaae2ecec8 "/home/julien/compile-libreoffice/libreoffice/include/rtl/ustring.hxx", line=500, function=0x2aaaae2ed740 "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 --- basic/source/runtime/methods.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'basic') diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 17e2c5f0c712..3b84e4bc0a16 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(); + if (!tmp.isEmpty()) + { + aCmdLine += " "; + aCmdLine += tmp; + } } else if( aCmdLine.isEmpty() ) { -- cgit