Commit 58e064a5 authored by Alan Alpert's avatar Alan Alpert Committed by Qt by Nokia

Check for null pointer dereference

Standard defensive programming

Change-Id: Ic2b89cacf06812441a2b8f02c6b22de431c50b4a
Reviewed-by: 's avatarChris Adams <christopher.adams@nokia.com>
parent 8dd59122
......@@ -539,7 +539,7 @@ void QQuickCanvasPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, F
q->sendEvent(oldActiveFocusItem, &event);
QQuickItem *afi = oldActiveFocusItem;
while (afi != scope) {
while (afi && afi != scope) {
if (QQuickItemPrivate::get(afi)->activeFocus) {
QQuickItemPrivate::get(afi)->activeFocus = false;
changed << afi;
......@@ -635,7 +635,7 @@ void QQuickCanvasPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item,
q->sendEvent(oldActiveFocusItem, &event);
QQuickItem *afi = oldActiveFocusItem;
while (afi != scope) {
while (afi && afi != scope) {
if (QQuickItemPrivate::get(afi)->activeFocus) {
QQuickItemPrivate::get(afi)->activeFocus = false;
changed << afi;
......
......@@ -1632,7 +1632,7 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus)
// Correct focus chain in scope
if (oldSubFocusItem) {
QQuickItem *sfi = scopePrivate->subFocusItem->parentItem();
while (sfi != scope) {
while (sfi && sfi != scope) {
QQuickItemPrivate::get(sfi)->subFocusItem = 0;
sfi = sfi->parentItem();
}
......@@ -1641,7 +1641,7 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus)
if (focus) {
scopePrivate->subFocusItem = q;
QQuickItem *sfi = scopePrivate->subFocusItem->parentItem();
while (sfi != scope) {
while (sfi && sfi != scope) {
QQuickItemPrivate::get(sfi)->subFocusItem = q;
sfi = sfi->parentItem();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment