fix crash when dropping a file into an empty QTextEdit
Since commit be0bfe09ee
we return -1 in
QTextEngine::findItem if the item cannot be found.
Calling code must be prepared for this case.
Otherwise we run into an out-of-bounds vector access later on.
Task-number: QTBUG-42103
Change-Id: Ie338cd1fc3cf0ce1e8edfa59dead635669020a33
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
parent
309e82021d
commit
c803af5167
@ -2559,6 +2559,10 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
|
||||
}
|
||||
else
|
||||
itm = eng->findItem(pos);
|
||||
if (itm < 0) {
|
||||
*cursorPos = 0;
|
||||
return x.toReal();
|
||||
}
|
||||
eng->shapeLine(line);
|
||||
|
||||
const QScriptItem *si = &eng->layoutData->items[itm];
|
||||
|
Loading…
Reference in New Issue
Block a user