diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx index 3a527124587d..cc3989a10066 100644 --- a/tools/source/inet/inetmsg.cxx +++ b/tools/source/inet/inetmsg.cxx @@ -327,8 +327,8 @@ bool INetRFC822Message::ParseDateField ( rDateTime.SetSec (ParseNumber (aDateField, nIndex)); nIndex++; rDateTime.SetNanoSec (0); - if ((aDateField[nIndex] == '+') || - (aDateField[nIndex] == '-') ) + const char cPossiblePlusMinus = nIndex < aDateField.getLength() ? aDateField[nIndex] : 0; + if (cPossiblePlusMinus == '+' || cPossiblePlusMinus == '-') { // Offset from GMT: "(+|-)HHMM". bool bEast = (aDateField[nIndex++] == '+');