diff options
| author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-05-19 15:55:29 +0200 |
|---|---|---|
| committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-05-20 15:46:21 +0200 |
| commit | afb081115d05c010aa4c80c985f69f8f333264c7 (patch) | |
| tree | 89a16561f27d62b4764aeeecff0a491b84a70e35 /src/quick/items/qquicktextnodeengine.cpp | |
| parent | 3a4e013f0058952c94ed3414aafbf96216efff8d (diff) | |
Don't dereference node unless it is actually assigned
While the static analyzer doesn't see in 727c503c234d162fb8d62b1aadf328de
that node must never be nullptr when i == 0, the statement doesn't have
to be executed at all if the previous block wasn't run as well to assign
node.
Pick-to: 6.1
Change-Id: I2edd901674e7603a317ebdf98dd4800b768a0a5b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/quick/items/qquicktextnodeengine.cpp')
| -rw-r--r-- | src/quick/items/qquicktextnodeengine.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp index 5c25ecf429..b3401200c8 100644 --- a/src/quick/items/qquicktextnodeengine.cpp +++ b/src/quick/items/qquicktextnodeengine.cpp @@ -269,11 +269,10 @@ void QQuickTextNodeEngine::processCurrentLine() Q_ASSERT(sortedIndex < m_currentLineTree.size()); node = m_currentLineTree.data() + sortedIndex; + if (i == 0) + currentSelectionState = node->selectionState; } - if (i == 0) - currentSelectionState = node->selectionState; - // Update decorations if (currentDecorations != Decoration::NoDecoration) { decorationRect.setY(m_position.y() + m_currentLine.y()); |
