Changed search to retry automatically couple of times before failing.
[jenirok] / src / common / eniro.cpp
index 46fda30..edffeed 100644 (file)
@@ -201,6 +201,13 @@ void Eniro::handleHttpData(int id, QByteArray const& data)
     if((searchIt = pendingSearches_.find(id)) !=
         pendingSearches_.end())
     {
+        if(data.isEmpty())
+        {
+            setError(CONNECTION_FAILURE, "Server returned empty data");
+            emitRequestFinished(id, searchIt.value(), true);
+            return;
+        }
+
         // Load results from html data
         loadResults(id, data);
     }
@@ -209,6 +216,13 @@ void Eniro::handleHttpData(int id, QByteArray const& data)
     else if((numberIt = pendingNumberRequests_.find(id)) !=
         pendingNumberRequests_.end())
     {
+        if(data.isEmpty())
+        {
+            setError(CONNECTION_FAILURE, "Server returned empty data");
+            emitRequestFinished(id, searchIt.value(), true);
+            return;
+        }
+
         // Load number from html data
         loadNumber(id, data);
     }