Commit 7ce81bd9 authored by Martin Flöser's avatar Martin Flöser

Do not crash if there is no QMimeData in decodeIsCutSelection

On Wayland the QMimeData is null and thus the Open File dialog
crashed when trying to enter a directory.

REVIEW: 115517
parent ab478863
......@@ -896,7 +896,7 @@ bool KFilePreviewGenerator::Private::isCutItem(const KFileItem &item) const
void KFilePreviewGenerator::Private::applyCutItemEffect(const KFileItemList &items)
{
const QMimeData *mimeData = QApplication::clipboard()->mimeData();
m_hasCutSelection = decodeIsCutSelection(mimeData);
m_hasCutSelection = mimeData && decodeIsCutSelection(mimeData);
if (!m_hasCutSelection) {
return;
}
......@@ -1128,6 +1128,9 @@ void KFilePreviewGenerator::Private::orderItems(KFileItemList &items)
bool KFilePreviewGenerator::Private::decodeIsCutSelection(const QMimeData *mimeData)
{
if (!mimeData) {
return false;
}
const QByteArray data = mimeData->data("application/x-kde-cutselection");
if (data.isEmpty()) {
return false;
......
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