diff options
author | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2010-02-26 12:28:45 (GMT) |
---|---|---|
committer | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2010-02-26 13:45:58 (GMT) |
commit | 573fee867d129654ca2eb629d8f0ffb7f515a324 (patch) | |
tree | 074369b7421c9be50715b3b09c13fb0d1ec6ba94 /src/gui/kernel | |
parent | 9229489304894e35e137606ea263f007e5605d22 (diff) | |
download | Qt-573fee867d129654ca2eb629d8f0ffb7f515a324.zip Qt-573fee867d129654ca2eb629d8f0ffb7f515a324.tar.gz Qt-573fee867d129654ca2eb629d8f0ffb7f515a324.tar.bz2 |
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
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qmime_win.cpp | 10 |
1 files 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<QUrl> 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<QUrl> 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); } } |