From 573fee867d129654ca2eb629d8f0ffb7f515a324 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Fri, 26 Feb 2010 13:28:45 +0100 Subject: Crash when dragging an empty URL-list. While converting the mime to native CF_ formats, we need to check the vaildity of the list. Task-number: QTBUG-8446 Reviewed-by: Thierry --- src/gui/kernel/qmime_win.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qmime_win.cpp b/src/gui/kernel/qmime_win.cpp index e191d7b..39633bf 100644 --- a/src/gui/kernel/qmime_win.cpp +++ b/src/gui/kernel/qmime_win.cpp @@ -640,14 +640,18 @@ bool QWindowsMimeURI::convertFromMime(const FORMATETC &formatetc, const QMimeDat } else if (getCf(formatetc) == CF_INETURL_W) { QList urls = mimeData->urls(); QByteArray result; - QString url = urls.at(0).toString(); - result = QByteArray((const char *)url.utf16(), url.length() * sizeof(ushort)); + if (!urls.isEmpty()) { + QString url = urls.at(0).toString(); + result = QByteArray((const char *)url.utf16(), url.length() * sizeof(ushort)); + } result.append('\0'); result.append('\0'); return setData(result, pmedium); } else if (getCf(formatetc) == CF_INETURL) { QList urls = mimeData->urls(); - QByteArray result = urls.at(0).toString().toLocal8Bit(); + QByteArray result; + if (!urls.isEmpty()) + result = urls.at(0).toString().toLocal8Bit(); return setData(result, pmedium); } } -- cgit v0.12