From e1fc2793aef53b84a3f1e19b6d6bdf1141340074 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 18 Jun 2013 09:54:24 +0200 Subject: [PATCH] Add missing null check to QQuickTextEdit::hoveredLink() Change-Id: Ie0cb144bb5596f566584b8bb80e334983dd2b50e Reviewed-by: Alan Alpert --- src/quick/items/qquicktextedit.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 4ddef5e..6e22628 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -2512,12 +2512,13 @@ QString QQuickTextEdit::hoveredLink() const return d->control->hoveredLink(); } else { #ifndef QT_NO_CURSOR - QPointF pos = QCursor::pos(window()->screen()) - window()->position() - mapToScene(QPointF(0, 0)); - return d->control->anchorAt(pos); -#else - return QString(); + if (QQuickWindow *wnd = window()) { + QPointF pos = QCursor::pos(wnd->screen()) - wnd->position() - mapToScene(QPointF(0, 0)); + return d->control->anchorAt(pos); + } #endif // QT_NO_CURSOR } + return QString(); } void QQuickTextEdit::hoverEnterEvent(QHoverEvent *event) -- 2.7.4