Safetey check in TabBox's Image Provider

We cannot provide pixmaps if the client is null or the index
is for "there are no windows".
This commit is contained in:
Martin Gräßlin 2011-11-10 21:23:14 +01:00
parent 43109f7264
commit 571a87a0b7

View file

@ -63,7 +63,13 @@ QPixmap ImageProvider::requestPixmap(const QString &id, QSize *size, const QSize
if (!index.isValid()) {
return QDeclarativeImageProvider::requestPixmap(id, size, requestedSize);
}
if (index.model()->data(index, ClientModel::EmptyRole).toBool()) {
return QDeclarativeImageProvider::requestPixmap(id, size, requestedSize);
}
TabBoxClient* client = static_cast< TabBoxClient* >(index.model()->data(index, ClientModel::ClientRole).value<void *>());
if (!client) {
return QDeclarativeImageProvider::requestPixmap(id, size, requestedSize);
}
QSize s(32, 32);
if (requestedSize.isValid()) {