mirror of
https://github.com/babalae/bettergi-scripts-list.git
synced 2026-03-29 05:39:51 +08:00
fix(tools): 解决排序功能中的空值异常问题
- 为 localeCompare 方法调用添加可选链操作符 - 防止当 a_key 为 null 或 undefined 时引发错误 - 确保排序逻辑在所有情况下都能正常执行
This commit is contained in:
@@ -890,7 +890,7 @@ async function initRun(config_run) {
|
||||
const orderA = orderMap.get(a_key) ?? 0; // 没在 JSON 中的排到最后
|
||||
const orderB = orderMap.get(b_key) ?? 0;
|
||||
if (orderA === orderB) {
|
||||
return a_key.localeCompare(b_key);
|
||||
return a_key?.localeCompare(b_key);
|
||||
}
|
||||
return orderB - orderA; // 修改为倒序数字比较
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user