summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2013-09-25 18:45:09 +0300
committerRobin Burchell <robin+qt@viroteck.net>2013-10-01 14:57:07 +0200
commit184636c72b697b760b081175d8e581718540064a (patch)
tree4a93dc1e55be474e728765b295b6a8fe9ab3f06d
parent8d958a836a5aa53e3d6c5079c19f8283f4ecf9a7 (diff)
Avoid dereferencing a null pointer when QMimeData is 0
QClipboard's QPA implementation of clear() calls setMimeData(0, mode), which means mimeData can be dereferenced when it is null. Prevent this from happening. Change-Id: Ib019926e1a7c002d365419db609028c258d364bc Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
-rw-r--r--src/plugins/platforms/wayland_common/qwaylanddatasource.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/platforms/wayland_common/qwaylanddatasource.cpp b/src/plugins/platforms/wayland_common/qwaylanddatasource.cpp
index 7bf8b0c96..318b924b5 100644
--- a/src/plugins/platforms/wayland_common/qwaylanddatasource.cpp
+++ b/src/plugins/platforms/wayland_common/qwaylanddatasource.cpp
@@ -96,6 +96,10 @@ QWaylandDataSource::QWaylandDataSource(QWaylandDataDeviceManager *dndSelectionHa
{
m_data_source = wl_data_device_manager_create_data_source(dndSelectionHandler->handle());
wl_data_source_add_listener(m_data_source,&data_source_listener,this);
+
+ if (!mimeData)
+ return;
+
QStringList formats = mimeData->formats();
for (int i = 0; i < formats.size(); i++) {
const char *offer = qPrintable(formats.at(i));