on xenial help sign in
add some checks if we actually clicked an item or in the spacing between them

gets rid of some warnings printed by the launcher . Approved by PS Jenkins bot, Albert Astals Cid.

commit0849e97cce48c01f4ea83854821f86a23207c9c3 authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 21 Aug 2013, 11:28 (13 years ago) parent6cb7581da19919
1 file changed+13−2
Launcher/LauncherPanel.qml+13−2
Launcher/LauncherPanel.qml+13−2
@@ -235,7 +235,7 @@ Item {
235235 property int draggedIndex: -1
236236 property var selectedItem
237237 property bool preDragging: false
238− property bool dragging: selectedItem !== undefined && selectedItem.dragging
238+ property bool dragging: selectedItem !== undefined && selectedItem !== null && selectedItem.dragging
239239 property bool postDragging: false
240240 property int startX
241241 property int startY
@@ -243,13 +243,20 @@ Item {
243243
244244 onPressed: {
245245 selectedItem = launcherListView.itemAt(mouseX, mouseY + launcherListView.realContentY)
246− selectedItem.highlighted = true
246+ if (selectedItem !== null) {
247+ selectedItem.highlighted = true
248+ }
247249 }
248250
249251 onClicked: {
250252 var index = Math.floor((mouseY + launcherListView.realContentY) / launcherListView.realItemHeight);
251253 var clickedItem = launcherListView.itemAt(mouseX, mouseY + launcherListView.realContentY)
252254
255+ // Check if we actually clicked an item or only at the spacing in between
256+ if (clickedItem === null) {
257+ return;
258+ }
259+
253260 // First/last item do the scrolling at more than 12 degrees
254261 if (index == 0 || index == launcherListView.count - 1) {
255262 if (clickedItem.angle > 12) {
@@ -287,6 +294,10 @@ Item {
287294 draggedIndex = -1;
288295 }
289296
297+ if (!selectedItem) {
298+ return;
299+ }
300+
290301 selectedItem.highlighted = false
291302 selectedItem.dragging = false;
292303 selectedItem = undefined;