From f05b36ae263116dc72f2fe85768a967c0eded529 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 1 Mar 2018 21:14:15 +0000 Subject: forcepoint #14 check to see if we incremented at all Change-Id: Ia4670adbddcc8501cf522be296b3061a3529f880 Reviewed-on: https://gerrit.libreoffice.org/50606 Tested-by: Jenkins Reviewed-by: Michael Stahl --- vcl/source/helper/strhelper.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'vcl/source') diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx index 648c579ac4c2..4d0f1d993cd6 100644 --- a/vcl/source/helper/strhelper.cxx +++ b/vcl/source/helper/strhelper.cxx @@ -300,9 +300,12 @@ OUString WhitespaceToSpace( const OUString& rLine, bool bProtect ) *pLeap = 0; // there might be a space at beginning or end - pLeap--; - if( *pLeap == ' ' ) - *pLeap = 0; + if (pLeap > pBuffer) + { + pLeap--; + if( *pLeap == ' ' ) + *pLeap = 0; + } return OUString(*pBuffer == ' ' ? pBuffer+1 : pBuffer); } -- cgit v1.2.3