From 4df3f1ab156e66466f9b1d2453901c27b32d257b Mon Sep 17 00:00:00 2001 From: Wang Zichong Date: Thu, 2 Nov 2023 17:29:49 +0800 Subject: [PATCH] fix: crash caused by index out-of-range MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复字母菜单尝试跳到目录时,遍历应用列表也未找到结果时,因 下标越界导致的访问数据为空所致崩溃。 Log: --- qml/AppListView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qml/AppListView.qml b/qml/AppListView.qml index 71aad3b5..6d2daa80 100644 --- a/qml/AppListView.qml +++ b/qml/AppListView.qml @@ -17,7 +17,7 @@ Item { signal sectionHeaderClicked(var categoryType) function scrollToAlphabetCategory(character) { - for (let i = 0; i <= model.count; i++) { + for (let i = 0; i < model.count; i++) { let transliterated1st = model.model.data(model.modelIndex(i), 4096)[0].toUpperCase() // 4096 is AppsModel::TransliteratedRole if (character === transliterated1st) { // we use the highlight move to scroll to item