Don't try to create a pixmap from an invalid HICON on Windows. Fixes issue 1417

This commit is contained in:
David Sansome 2011-03-13 22:14:23 +00:00
parent a37bb47e53
commit f37467ac69
1 changed files with 8 additions and 3 deletions

View File

@ -175,10 +175,15 @@ WmdmLister::DeviceInfo WmdmLister::ReadDeviceInfo(IWMDMDevice2* device) {
// Get the icon
HICON icon;
device->GetDeviceIcon((ULONG*)&icon);
if (device->GetDeviceIcon((ULONG*)&icon) == S_OK) {
// Extra check for whether the icon is valid (see issue 1417)
ret.icon_ = QPixmap::fromWinHICON(icon);
DestroyIcon(icon);
ICONINFO iconinfo;
if (GetIconInfo(icon, &iconinfo)) {
ret.icon_ = QPixmap::fromWinHICON(icon);
DestroyIcon(icon);
}
}
// Get the main (first) storage for the device
IWMDMEnumStorage* storage_it = NULL;