diff options
Diffstat (limited to 'tdecore/krfcdate.cpp')
-rw-r--r-- | tdecore/krfcdate.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tdecore/krfcdate.cpp b/tdecore/krfcdate.cpp index 327736b40..08691fd15 100644 --- a/tdecore/krfcdate.cpp +++ b/tdecore/krfcdate.cpp @@ -431,12 +431,16 @@ KRFCDate::parseDateISO8601( const TQString& input_ ) l = TQStringList::split(':', timeString); - if (l.size() < 3) + // If the 'T' separator was included, there must at least + // be the hour, if not then it is invalid. + if (l.size() < 1) return 0; hour = l[0].toUInt(); - min = l[1].toUInt(); - sec = l[2].toUInt(); + + // Minutes and seconds can be omitted. + min = (l.size() >= 2) ? l[1].toUInt() : 0; + sec = (l.size() >= 3) ? l[2].toUInt() : 0; time_t result = ymdhms_to_seconds(year, month, mday, hour, min, sec); |