diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2020-01-21 14:39:06 +0200 |
---|---|---|
committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2021-01-18 17:35:05 +0200 |
commit | 989193f14c4a479deaa5479387fc5161b06d04b7 (patch) | |
tree | 99e133765391ba5ca18ba73e61e04ed6f93b003c | |
parent | 249264b77851e8f230c3e11853d1a0c79698e7b6 (diff) |
Fix WCL menu related QML warning
If keyboard is dismissed while the WCL menu is
active, the following error is produced:
qrc:/QtQuick/VirtualKeyboard/content/components/Keyboard.qml:1302: TypeError: Cannot read property 'width' of null
It is caused by accessing currentItem of a list
without checking null value.
Change-Id: I716e1f10d192169f28de9951e10a0a472e4dd14a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r-- | src/virtualkeyboard/content/components/Keyboard.qml | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/virtualkeyboard/content/components/Keyboard.qml b/src/virtualkeyboard/content/components/Keyboard.qml index 4a4bd889..812dfb2e 100644 --- a/src/virtualkeyboard/content/components/Keyboard.qml +++ b/src/virtualkeyboard/content/components/Keyboard.qml @@ -1296,6 +1296,8 @@ Item { wordCandidateView.currentIndex = wordCandidateIndex wordCandidateContextMenuList.anchors.leftMargin = Qt.binding(function() { + if (!wordCandidateView.currentItem) + return 0 var leftBorder = Math.round(wordCandidateView.mapFromItem(wordCandidateView.currentItem, (wordCandidateView.currentItem.width - wordCandidateContextMenuList.width) / 2, 0).x) var rightBorder = Math.round(wordCandidateContextMenuList.parent.width - wordCandidateContextMenuList.width) return Math.min(leftBorder, rightBorder) |