Fix potential crash if there is no image format pasted

This commit is contained in:
Nicolas Werner 2022-03-21 22:54:44 +01:00
parent 15ff5dace5
commit 5734641778
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -155,7 +155,8 @@ InputBar::insertMimeData(const QMimeData *md)
if (md->hasImage()) {
if (formats.contains(QStringLiteral("image/svg+xml"), Qt::CaseInsensitive)) {
startUploadFromMimeData(*md, QStringLiteral("image/svg+xml"));
} else if (formats.contains(QStringLiteral("image/png"), Qt::CaseInsensitive)) {
} else if (formats.contains(QStringLiteral("image/png"), Qt::CaseInsensitive) ||
formats.empty()) {
startUploadFromMimeData(*md, QStringLiteral("image/png"));
} else {
startUploadFromMimeData(*md, image.first());