fix(QClipboardProxy): check if mimedata is not null

Pointer returned by QClipboard::mimeData may be null, e.g. during
tests in headless mode, causing segfault.
This commit is contained in:
Michał Cieślak 2023-10-10 15:26:25 +02:00 committed by Michał
parent cd870a2e56
commit 0caec2ab1c
1 changed files with 2 additions and 1 deletions

View File

@ -36,7 +36,8 @@ bool QClipboardProxy::hasHtml() const
QString QClipboardProxy::html() const
{
return m_clipboard->mimeData()->html();
auto mimeData = m_clipboard->mimeData();
return mimeData ? mimeData->html() : QString{};
}
bool QClipboardProxy::hasImage() const