forked from qt-creator/qt-creator
QmlDesigner: Fix nodeAtTextCursorPositionRekursive()
If the length is -1 then the document is invalid and we should return an invalid model node. Change-Id: Id2a329a16617f862a518a3c1f00f9078697d72d8 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Tim Jenssen
parent
73f8308959
commit
b3238d5736
@@ -582,6 +582,10 @@ ModelNode RewriterView::nodeAtTextCursorPositionRekursive(const ModelNode &root,
|
||||
|
||||
const int nodeTextLength = nodeLength(node);
|
||||
const int nodeTextOffset = nodeOffset(node);
|
||||
|
||||
if (nodeTextLength < 0)
|
||||
return ModelNode();
|
||||
|
||||
if (isInNodeDefinition(nodeTextOffset, nodeTextLength, cursorPosition))
|
||||
return node;
|
||||
|
||||
|
Reference in New Issue
Block a user