summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/dbgui/validate.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx
index 688ebe5b7043..78d2c154c319 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -277,12 +277,16 @@ ScConditionMode lclGetCondModeFromPos( sal_uInt16 nLbPos )
void lclGetFormulaFromStringList( OUString& rFmlaStr, const OUString& rStringList, sal_Unicode cFmlaSep )
{
rFmlaStr.clear();
- sal_Int32 nTokenCnt = comphelper::string::getTokenCount(rStringList, '\n');
- for( sal_Int32 nToken = 0, nStringIx = 0; nToken < nTokenCnt; ++nToken )
+ if (!rStringList.isEmpty())
{
- OUString aToken( rStringList.getToken( 0, '\n', nStringIx ) );
- ScGlobal::AddQuotes( aToken, '"' );
- rFmlaStr = ScGlobal::addToken(rFmlaStr, aToken, cFmlaSep);
+ sal_Int32 nIdx {0};
+ do
+ {
+ OUString aToken {rStringList.getToken( 0, '\n', nIdx )};
+ ScGlobal::AddQuotes( aToken, '"' );
+ rFmlaStr = ScGlobal::addToken(rFmlaStr, aToken, cFmlaSep);
+ }
+ while (nIdx>0);
}
if( rFmlaStr.isEmpty() )
rFmlaStr = "\"\"";