From 000022b668921ebe1e8c6fe9647011f20934e430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9ven=20Car?= Date: Wed, 6 Nov 2019 15:20:23 +0100 Subject: [PATCH] MobileTextActionsToolBar check if controlRoot is undefined before using it Summary: Prevents warning such as qml/org/kde/plasma/components.3/mobiletextselection/MobileTextActionsToolBar.qml:62: TypeError: Cannot read property 'selectedText' of null qml/org/kde/plasma/components.3/mobiletextselection/MobileTextActionsToolBar.qml:70: TypeError: Cannot read property 'selectedText' of null qml/org/kde/plasma/components.3/mobiletextselection/MobileTextActionsToolBar.qml:78: TypeError: Cannot read property 'canPaste' of null Reviewers: #plasma, apol Reviewed By: apol Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D25164 --- .../mobiletextselection/MobileTextActionsToolBar.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarativeimports/plasmacomponents3/mobiletextselection/MobileTextActionsToolBar.qml b/src/declarativeimports/plasmacomponents3/mobiletextselection/MobileTextActionsToolBar.qml index fa8b1e16d..44e322650 100644 --- a/src/declarativeimports/plasmacomponents3/mobiletextselection/MobileTextActionsToolBar.qml +++ b/src/declarativeimports/plasmacomponents3/mobiletextselection/MobileTextActionsToolBar.qml @@ -59,7 +59,7 @@ Popup { ToolButton { focusPolicy: Qt.NoFocus icon.name: "edit-cut" - visible: controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal) + visible: controlRoot && controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal) onClicked: { controlRoot.cut(); } @@ -67,7 +67,7 @@ Popup { ToolButton { focusPolicy: Qt.NoFocus icon.name: "edit-copy" - visible: controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal) + visible: controlRoot && controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal) onClicked: { controlRoot.copy(); } @@ -75,7 +75,7 @@ Popup { ToolButton { focusPolicy: Qt.NoFocus icon.name: "edit-paste" - visible: controlRoot.canPaste + visible: controlRoot && controlRoot.canPaste onClicked: { controlRoot.paste(); }