Consistently check for nullptr in QGraphicsTextItem::inputMethodQuery
If dd->control is nullptr, then it's nullptr all the way, so don't dereference it in the calls to dd->controlOffset. Fixes static analyzer warning 9c33d9bc9b8cf438dccb63aa52afcbe0. Pick-to: 6.1 6.0 5.15 Change-Id: I7a61b6438422373678d4fcb66255b750c550724d Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
98e4652a96
commit
7edf0fbb9e
@ -10311,6 +10311,7 @@ QVariant QGraphicsTextItem::inputMethodQuery(Qt::InputMethodQuery query) const
|
|||||||
v = int(inputMethodHints());
|
v = int(inputMethodHints());
|
||||||
else if (dd->control)
|
else if (dd->control)
|
||||||
v = dd->control->inputMethodQuery(query, QVariant());
|
v = dd->control->inputMethodQuery(query, QVariant());
|
||||||
|
if (dd->control) {
|
||||||
if (v.userType() == QMetaType::QRectF)
|
if (v.userType() == QMetaType::QRectF)
|
||||||
v = v.toRectF().translated(-dd->controlOffset());
|
v = v.toRectF().translated(-dd->controlOffset());
|
||||||
else if (v.userType() == QMetaType::QPointF)
|
else if (v.userType() == QMetaType::QPointF)
|
||||||
@ -10319,6 +10320,7 @@ QVariant QGraphicsTextItem::inputMethodQuery(Qt::InputMethodQuery query) const
|
|||||||
v = v.toRect().translated(-dd->controlOffset().toPoint());
|
v = v.toRect().translated(-dd->controlOffset().toPoint());
|
||||||
else if (v.userType() == QMetaType::QPoint)
|
else if (v.userType() == QMetaType::QPoint)
|
||||||
v = v.toPoint() - dd->controlOffset().toPoint();
|
v = v.toPoint() - dd->controlOffset().toPoint();
|
||||||
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user