Fix the problem that the top and favorite state cannot be set to 0.

This commit is contained in:
JunjieBai 2023-02-15 09:45:21 +08:00
parent 738f116b83
commit 7f2267d72a
1 changed files with 2 additions and 2 deletions

View File

@ -891,7 +891,7 @@ bool AppDBManager::handleFavoritesStateUpdate(const QString &desktopfp, int num)
qWarning() << "Fail to exec:" << cmd << "because:" << m_database.lastError(); qWarning() << "Fail to exec:" << cmd << "because:" << m_database.lastError();
} else { } else {
while (sql.next()) { while (sql.next()) {
if (sql.value("FAVORITES").toInt() == num) { if (num && sql.value("FAVORITES").toInt() == num) {
res = false; res = false;
if (sql.value("DESKTOP_FILE_PATH").toString() == desktopfp) { if (sql.value("DESKTOP_FILE_PATH").toString() == desktopfp) {
qWarning() << "favorites state has no changes, I quit!"; qWarning() << "favorites state has no changes, I quit!";
@ -938,7 +938,7 @@ bool AppDBManager::handleTopStateUpdate(const QString &desktopfp, int num)
qWarning() << "Fail to exec:" << cmd << "because:" << m_database.lastError(); qWarning() << "Fail to exec:" << cmd << "because:" << m_database.lastError();
} else { } else {
while (sql.next()) { while (sql.next()) {
if (sql.value("TOP").toInt() == num) { if (num && sql.value("TOP").toInt() == num) {
res = false; res = false;
if (sql.value("DESKTOP_FILE_PATH").toString() == desktopfp) { if (sql.value("DESKTOP_FILE_PATH").toString() == desktopfp) {
qWarning() << "top state has no changes, I quit!"; qWarning() << "top state has no changes, I quit!";