[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/source

Lionel Elie Mamane lionel at mamane.lu
Mon Jul 29 01:29:22 PDT 2013


 vcl/source/control/field2.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit b7d74f9e95c7977ff2b527267661d7760c945c02
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sun Jul 28 15:56:25 2013 +0200

    protect against past-the-end access of empty string
    
    Change-Id: I4518d1a2795f4775aec7f3eb495e39afe30ec7be
    Reviewed-on: https://gerrit.libreoffice.org/5151
    Reviewed-by: Luboš Luňák <l.lunak at suse.cz>
    Tested-by: Luboš Luňák <l.lunak at suse.cz>

diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index da08f7d..af0bf3e 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -2288,13 +2288,13 @@ static bool ImplTimeGetValue( const OUString& rStr, Time& rTime,
                 return false;
 
             nSepPos = aStr.indexOf( rLocaleDataWrapper.getTimeSep() );
-            if ( aStr[0] == '-' )
+            if ( !aStr.isEmpty() && aStr[0] == '-' )
                 bNegative = true;
             if ( nSepPos >= 0 )
             {
                 if ( !ImplCutTimePortion( aStr, nSepPos, _bSkipInvalidCharacters, &nSecond ) )
                     return false;
-                if ( aStr[0] == '-' )
+                if ( !aStr.isEmpty() && aStr[0] == '-' )
                     bNegative = true;
                 n100Sec = (short)aStr.toString().toInt32();
             }
@@ -2318,7 +2318,7 @@ static bool ImplTimeGetValue( const OUString& rStr, Time& rTime,
         aStr.remove( 0, nSepPos+1 );
 
         nSepPos = aStr.indexOf( rLocaleDataWrapper.getTimeSep() );
-        if ( aStr[0] == '-' )
+        if ( !aStr.isEmpty() && aStr[0] == '-' )
             bNegative = true;
         if ( nSepPos >= 0 )
         {
@@ -2327,7 +2327,7 @@ static bool ImplTimeGetValue( const OUString& rStr, Time& rTime,
             aStr.remove( 0, nSepPos+1 );
 
             nSepPos = aStr.indexOf( rLocaleDataWrapper.getTimeSep() );
-            if ( aStr[0] == '-' )
+            if ( !aStr.isEmpty() && aStr[0] == '-' )
                 bNegative = true;
             if ( nSepPos >= 0 )
             {


More information about the Libreoffice-commits mailing list