X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=blobdiff_plain;f=src%2Fdatabases%2FCookiesDatabase.cpp;fp=src%2Fdatabases%2FCookiesDatabase.cpp;h=8464c0624a4f728c4532efa33eacb93f2bbda18e;hp=a99290985cd7c5f28e971c3e50250f2567aa5aec;hb=83e7c484d2440bfff54e8d02b2d532c2aba755ef;hpb=adf448e4cca7b96f6db9fc2048e9a64fa24a9bba diff --git a/src/databases/CookiesDatabase.cpp b/src/databases/CookiesDatabase.cpp index a992909..8464c06 100644 --- a/src/databases/CookiesDatabase.cpp +++ b/src/databases/CookiesDatabase.cpp @@ -163,11 +163,18 @@ int CookiesDatabase::cookieCount() // Execute the query. countCookiesQuery.exec(); - // Move to the last row. - countCookiesQuery.last(); + // Initialize a number of cookies variable. + int numberOfCookies = 0; - // Get the number of rows (which is zero based). - int numberOfCookies = countCookiesQuery.at() + 1; + // Check to see if the query is valid (there is at least one cookie). + if (countCookiesQuery.isValid()) + { + // Move to the last row. + countCookiesQuery.last(); + + // Get the number of rows (which is zero based) and add one to calculate the number of cookies. + numberOfCookies = countCookiesQuery.at() + 1; + } // Return the number of cookies. return numberOfCookies; @@ -351,14 +358,14 @@ bool CookiesDatabase::isUpdate(const QNetworkCookie &cookie) (isUpdateQuery.value(2).toBool() != cookie.isSecure()) || (isUpdateQuery.value(3).toString().toUtf8() != cookie.value())) // The cookies data has changed. { - qDebug() << "The durable cookie data has changed."; + //qDebug() << "The durable cookie data has changed."; // Return true. return true; } else // The cookie data has not changed. { - qDebug() << "The durable cookie data is unchanged."; + //qDebug() << "The durable cookie data is unchanged."; // Return false. return false;