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
This commit is contained in:
Méven Car 2019-11-06 15:20:23 +01:00
parent 876dafaedb
commit 000022b668

View File

@ -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();
}