Commit 4858d61d authored by Elvis Stansvik's avatar Elvis Stansvik
Browse files

Fix crash when dropping image.

Apparently it can happen that QMimeData::hasImage() can return true, but
QMimeData::imageData returns a null QImage. I guess this should be
considered a Qt bug.

This fix simply introduces a check for a null image to avoid a crash
when this happens. I guess we should investigate why Qt ends up in this
state in the first place, but it doesn't hurt to be careful.

REVIEW: 110593
parent 3f20831b
......@@ -244,7 +244,12 @@ void KoView::dropEvent(QDropEvent *event)
QList<QImage> images;
if (event->mimeData()->hasImage()) {
images << event->mimeData()->imageData().value<QImage>();
QImage image = event->mimeData()->imageData().value<QImage>();
if (!image.isNull()) {
// apparently hasImage() && imageData().value<QImage>().isNull()
// can hold sometimes (Qt bug?).
images << image;
else if (event->mimeData()->hasUrls()) {
QList<QUrl> urls = event->mimeData()->urls();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment