diff --git a/src/game.cpp b/src/game.cpp index cb3fa6e..794911d 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -399,7 +399,12 @@ Game *Game::fromJson(const QJsonObject &json, QObject *parent) game->setWorkingDirectory(workingDirectory); game->setPlatform(platform); game->setPlatformId(platformId); - game->setDateAdded(QDateTime::fromString(json[QStringLiteral("dateAdded")].toString(), Qt::ISODate)); + { + const QDateTime dt = QDateTime::fromString(json[QStringLiteral("dateAdded")].toString(), Qt::ISODate); + if (dt.isValid()) { + game->setDateAdded(dt); + } + } game->setLastPlayed(QDateTime::fromString(json[QStringLiteral("lastPlayed")].toString(), Qt::ISODate)); game->setPlayTime(json[QStringLiteral("playTime")].toInteger()); game->setFavorite(json[QStringLiteral("favorite")].toBool());