Diffstat (limited to 'library/backend/timeconversion.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | library/backend/timeconversion.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/library/backend/timeconversion.cpp b/library/backend/timeconversion.cpp index 3c25922..df7b0d5 100644 --- a/library/backend/timeconversion.cpp +++ b/library/backend/timeconversion.cpp @@ -25,15 +25,24 @@ QString TimeConversion::toString( const QDate &d )
{
- QString r = QString::number( d.day() ) + "." +
+ QString empty;
+ if ( d.isNull() )
+ return empty;
+
+ QString r = QString::number( d.day() ) + "." +
QString::number( d.month() ) + "." +
QString::number( d.year() );
- //qDebug("TimeConversion::toString %s", r.latin1());
- return r;
+ //qDebug("TimeConversion::toString %s", r.latin1());
+
+ return r;
}
QDate TimeConversion::fromString( const QString &datestr )
{
+ QDate empty;
+ if ( datestr.isEmpty() )
+ return empty;
+
int monthPos = datestr.find('.');
int yearPos = datestr.find('.', monthPos+1 );
if ( monthPos == -1 || yearPos == -1 ) {
|