Skip to content

Commit 0128283

Browse files
fix: overflow in last page of "Latest Patchsets from"
In the "Latest Patchsets from" screen, if, for a given target list, there are, say, 40 patchsets in total, and the page size is 25, the last page (the second one) will have 15 patchsets. In this case, if the bottom patchset is selected (the 15th one) and the user continues feeding input to select the below patchset, the app "will select" the 16th, then the 17th, and so on until the 25th of this page "is selected". This causes panics, if the user tries to access these invalid patchsets. To fix this, use the actual number of patchsets processed instead the page number times the page size to check if we can select the below patchset. Signed-off-by: David Tadokoro <[email protected]> Co-developed-by: OJarrisonn <[email protected]>
1 parent aa47efd commit 0128283

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl LatestPatchsetsState {
8686
}
8787

8888
pub fn select_below_patchset(self: &mut Self) {
89-
if self.patchset_index + 1 < self.page_size * &self.page_number {
89+
if self.patchset_index + 1 < self.lore_session.get_representative_patches_ids().len() as u32 {
9090
self.patchset_index += 1;
9191
}
9292
}

0 commit comments

Comments
 (0)