Discovery: Add a sanity check when results are parsed
authorMarkus Goetz <markus@woboq.com>
Mon, 13 Apr 2015 13:10:04 +0000 (15:10 +0200)
committerMarkus Goetz <markus@woboq.com>
Mon, 13 Apr 2015 13:10:04 +0000 (15:10 +0200)
src/libsync/discoveryphase.cpp

index b8c580a12f150346bd907be5762845769abb4ba1..9c36c1286616a8a99ee3b18ef5fdf8c0757274ec 100644 (file)
@@ -285,6 +285,13 @@ void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(QString file,QMap
 
 void DiscoverySingleDirectoryJob::lsJobFinishedWithoutErrorSlot()
 {
+    if (!_ignoredFirst) {
+        // This is a sanity check, if we haven't _ignoredFirst then it means we never received any directoryListingIteratedSlot
+        // which means somehow the server XML was bogus
+        emit finishedWithError(ERRNO_WRONG_CONTENT, QLatin1String("Server error: PROPFIND reply is not XML formatted!"));
+        deleteLater();
+        return;
+    }
     emit etagConcatenation(_etagConcatenation);
     emit finishedWithResult(_results);
     deleteLater();