In certain cases the existing code would access an index past the end of
the pageStack

/D

>From b7097228532e41cf2efe772fb922d51c7ab72f69 Mon Sep 17 00:00:00 2001
From: Dirk Hohndel <d...@hohndel.org>
Date: Wed, 27 Jan 2016 07:05:35 -0800
Subject: [PATCH] Don't access past the last element of the pageStack

Signed-off-by: Dirk Hohndel <d...@hohndel.org>
---
 components/mobilecomponents/qml/PageRow.qml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/components/mobilecomponents/qml/PageRow.qml b/components/mobilecomponents/qml/PageRow.qml
index 50cf77bde7e4..c331ee5dfdbb 100644
--- a/components/mobilecomponents/qml/PageRow.qml
+++ b/components/mobilecomponents/qml/PageRow.qml
@@ -153,7 +153,9 @@ Item {
                 if (isNaN(mainFlickable.contentX)) {
                     return;
                 }
-                actualRoot.lastVisiblePage = Engine.pageStack[Math.floor((mainFlickable.contentX + mainFlickable.width - 1)/columnWidth)].page;
+                var lastIdx = Math.min(Engine.pageStack.length-1, Math.floor((mainFlickable.contentX + mainFlickable.width - 1)/columnWidth))
+                actualRoot.lastVisiblePage = Engine.pageStack[lastIdx].page;
+
                 if (!actualRoot.lastVisiblePage) {
                     actualRoot.lastVisiblePage = actualRoot.currentPage;
                 }
-- 
2.7.0

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to