Add extra checks so we never return empty QMimeData from mimeData().

This commit is contained in:
Felix Geyer 2013-04-07 11:50:42 +02:00
parent 91868969ca
commit 4b3bee6400
2 changed files with 16 additions and 4 deletions

View File

@ -227,8 +227,14 @@ QMimeData* EntryModel::mimeData(const QModelIndexList& indexes) const
}
}
data->setData(mimeTypes().first(), encoded);
return data;
if (seenEntries.isEmpty()) {
delete data;
return Q_NULLPTR;
}
else {
data->setData(mimeTypes().first(), encoded);
return data;
}
}
void EntryModel::entryAboutToAdd(Entry* entry)

View File

@ -313,8 +313,14 @@ QMimeData* GroupModel::mimeData(const QModelIndexList& indexes) const
}
}
data->setData(mimeTypes().first(), encoded);
return data;
if (seenGroups.isEmpty()) {
delete data;
return Q_NULLPTR;
}
else {
data->setData(mimeTypes().first(), encoded);
return data;
}
}
void GroupModel::groupDataChanged(Group* group)