From 2c7b8941ae4e70787f56fc277b582c8c698716d3 Mon Sep 17 00:00:00 2001
From: ABBAPOH <ABBAPOH@nextmail.ru>
Date: Fri, 13 Dec 2013 19:27:03 +0400
Subject: [PATCH] Fix QDDSHandler::canRead to return false in case of a scan
 error.

Change-Id: If776b122c90d79d430916677a46684770870956a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Alex Char <prevedtest@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
---
 src/plugins/imageformats/dds/qddshandler.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/plugins/imageformats/dds/qddshandler.cpp b/src/plugins/imageformats/dds/qddshandler.cpp
index 428659fd..c85e75d2 100644
--- a/src/plugins/imageformats/dds/qddshandler.cpp
+++ b/src/plugins/imageformats/dds/qddshandler.cpp
@@ -1238,10 +1238,14 @@ QByteArray QDDSHandler::name() const
 
 bool QDDSHandler::canRead() const
 {
-    if (canRead(device())) {
+    if (m_scanState == ScanNotScanned && !canRead(device()))
+        return false;
+
+    if (m_scanState != ScanError) {
         setFormat(QByteArrayLiteral("dds"));
         return true;
     }
+
     return false;
 }
 
-- 
GitLab