From 7e61bfe813347949307cdf2876ead3cc42e4cd7b Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 6 Feb 2014 23:49:20 +0100 Subject: fdo#74474: sw: fix Label wizard document creation Infinite loop in InsertLabEnvText() due to wrong handling of starting '<'. (regression from fa469b2e00d83459faebe4c1fcb3ea1aac5fb20d) Change-Id: I1d7ab1b276756bddd87890bb39d3e817330bc6dd --- sw/source/ui/app/appenv.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx index 8d3842a3721e..b068661a7053 100644 --- a/sw/source/ui/app/appenv.cxx +++ b/sw/source/ui/app/appenv.cxx @@ -90,10 +90,11 @@ OUString InsertLabEnvText( SwWrtShell& rSh, SwFldMgr& rFldMgr, const OUString& r bool bField = false; sal_Int32 nPos = aLine.indexOf( '<' ); - if ( nPos != -1) + if (0 != nPos) { - sTmpText = aLine.copy( 0, nPos ); - aLine = aLine.copy( nPos ); + sal_Int32 const nCopy((nPos != -1) ? nPos : aLine.getLength()); + sTmpText = aLine.copy(0, nCopy); + aLine = aLine.copy(nCopy); } else { -- cgit v1.2.3