1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[Fix] Infinite loop on bookmarking a page while history is empty

Previous fix as in 7a1bbd9 introduced new bug with history
sidebar being always empty.
This commit fixes this bug.
This commit is contained in:
Franz Fellner 2012-12-08 11:39:03 +01:00 committed by nowrep
parent f30092e7e2
commit 454d0d47dd

View File

@ -446,15 +446,18 @@ void HistoryModel::init()
{
QSqlQuery query;
query.exec("SELECT MIN(date) FROM history");
if (query.size() <= 0) {
if (!query.next()) {
return;
}
const qint64 &minTimestamp = query.value(0).toLongLong();
if (minTimestamp <= 0) {
return;
}
const QDate &today = QDate::currentDate();
const QDate &week = today.addDays(1 - today.dayOfWeek());
const QDate &month = QDate(today.year(), today.month(), 1);
const qint64 &minTimestamp = query.value(0).toLongLong();
const qint64 &currentTimestamp = QDateTime::currentMSecsSinceEpoch();
qint64 timestamp = currentTimestamp;