Commit 149f6501 authored by Kurt Hindenburg's avatar Kurt Hindenburg

fix Wayland crashes by checking event->mimeData()

parent 4cd725ff
......@@ -3303,15 +3303,21 @@ void TerminalDisplay::dragEnterEvent(QDragEnterEvent* event)
// text/uri-list is for supporting some non-KDE apps, such as thunar
// and pcmanfm
// That also applies in dropEvent()
if (event->mimeData()->hasFormat(QStringLiteral("text/plain")) ||
event->mimeData()->hasFormat(QStringLiteral("text/uri-list"))) {
const auto mimeData = event->mimeData();
if (mimeData
&& (mimeData->hasFormat(QStringLiteral("text/plain"))
|| mimeData->hasFormat(QStringLiteral("text/uri-list")))) {
event->acceptProposedAction();
}
}
void TerminalDisplay::dropEvent(QDropEvent* event)
{
auto urls = event->mimeData()->urls();
const auto mimeData = event->mimeData();
if (!mimeData) {
return;
}
auto urls = mimeData->urls();
QString dropText;
if (!urls.isEmpty()) {
......@@ -3381,11 +3387,11 @@ void TerminalDisplay::dropEvent(QDropEvent* event)
}
} else {
dropText = event->mimeData()->text();
dropText = mimeData->text();
}
if (event->mimeData()->hasFormat(QStringLiteral("text/plain")) ||
event->mimeData()->hasFormat(QStringLiteral("text/uri-list"))) {
if (mimeData->hasFormat(QStringLiteral("text/plain")) ||
mimeData->hasFormat(QStringLiteral("text/uri-list"))) {
emit sendStringToEmu(dropText.toLocal8Bit());
}
}
......
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