QWidgetTextControl: deal with empty formats list properly
Do not call first on it. A regression was introduced by
56f0ebfe86
.
Fixes: QTBUG-110070
Pick-to: 6.5 6.4
Change-Id: I7c969da889b6c7ad3a67149fe99ca47830683073
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
ae3ffc1d4b
commit
0cd153b268
@ -2699,7 +2699,8 @@ void QWidgetTextControl::insertFromMimeData(const QMimeData *source)
|
||||
bool hasData = false;
|
||||
QTextDocumentFragment fragment;
|
||||
#if QT_CONFIG(textmarkdownreader)
|
||||
if (source->formats().first() == "text/markdown"_L1) {
|
||||
const auto formats = source->formats();
|
||||
if (formats.size() && formats.first() == "text/markdown"_L1) {
|
||||
auto s = QString::fromUtf8(source->data("text/markdown"_L1));
|
||||
fragment = QTextDocumentFragment::fromMarkdown(s);
|
||||
hasData = true;
|
||||
|
Loading…
Reference in New Issue
Block a user