summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2013-07-28 15:56:25 +0200
committerLuboš Luňák <l.lunak@suse.cz>2013-07-29 08:29:02 +0000
commitb7d74f9e95c7977ff2b527267661d7760c945c02 (patch)
tree3aa53797e67e36d006499e42f14bb7485419c3f5
parentd915d7252c1997729892ab5f62680beeefe861aa (diff)
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@suse.cz> Tested-by: Luboš Luňák <l.lunak@suse.cz>
-rw-r--r--vcl/source/control/field2.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index da08f7dfc383..af0bf3ece0e4 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 )
{