src/gui/itemviews/qfileiconprovider.cpp
branchRCL_3
changeset 14 c0432d11811c
parent 5 d3bac044e0f0
--- a/src/gui/itemviews/qfileiconprovider.cpp	Wed Apr 21 12:15:23 2010 +0300
+++ b/src/gui/itemviews/qfileiconprovider.cpp	Wed Apr 21 20:15:53 2010 +0300
@@ -254,7 +254,9 @@
     val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info,
                         sizeof(SHFILEINFO), SHGFI_SMALLICON|SHGFI_SYSICONINDEX);
 #endif
-    if (val) {
+
+    // Even if GetFileInfo returns a valid result, hIcon can be empty in some cases
+    if (val && info.hIcon) {
         if (fileInfo.isDir() && !fileInfo.isRoot()) {
             //using the unique icon index provided by windows save us from duplicate keys
             key = QString::fromLatin1("qt_dir_%1").arg(info.iIcon);
@@ -293,7 +295,7 @@
     val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info,
                         sizeof(SHFILEINFO), SHGFI_LARGEICON|SHGFI_SYSICONINDEX);
 #endif
-    if (val) {
+    if (val && info.hIcon) {
         if (fileInfo.isDir() && !fileInfo.isRoot()) {
             //using the unique icon index provided by windows save us from duplicate keys
             key = QString::fromLatin1("qt_dir_%1").arg(info.iIcon);