summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/ui/app/appenv.cxx7
1 files 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
{