Merge "Disable Cherry pick button if no change is selected"
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.ts b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.ts
index b1e639e..c2faa0c 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.ts
@@ -461,7 +461,10 @@
// Private but used in tests
async sectionsChanged() {
- this.cursor.stops = await this.getListItems();
+ // Ensure we have a valid array for cursor.stops even if getListItems() returns undefined
+ // This prevents TypeError when forEach is called on cursor.stops
+ const items = await this.getListItems();
+ this.cursor.stops = items ?? [];
this.cursor.moveToStart();
if (this.selectedIndex) this.cursor.setCursorAtIndex(this.selectedIndex);
}