]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/databases/CookiesDatabase.cpp
Implement loading of new tabs from the context menu.
[PrivacyBrowserPC.git] / src / databases / CookiesDatabase.cpp
index a99290985cd7c5f28e971c3e50250f2567aa5aec..207f45b89795c3ead31d00313cb78654890056c7 100644 (file)
@@ -166,8 +166,15 @@ int CookiesDatabase::cookieCount()
     // Move to the last row.
     countCookiesQuery.last();
 
-    // Get the number of rows (which is zero based).
-    int numberOfCookies = countCookiesQuery.at() + 1;
+    // Initialize a number of cookies variable.
+    int numberOfCookies = 0;
+
+    // Check to see if the query is valid (there is at least one cookie).
+    if (countCookiesQuery.isValid())
+    {
+        // 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;