chiark / gitweb /
File draw method: add a missing bounds check.
authorSimon Tatham <anakin@pobox.com>
Sun, 31 Dec 2023 13:37:49 +0000 (13:37 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 31 Dec 2023 13:37:49 +0000 (13:37 +0000)
Don't try to render an item that doesn't even exist at all.

src/file.rs

index 2dcabf66fec9fb22a7f1a2853dbd0e42ec3598e8..ae2427d9507e5073e6f7569883b76205cf8f894f 100644 (file)
@@ -354,6 +354,7 @@ impl<Type: FeedType> ActivityState for FeedFile<Type> {
 
         // Retrieve rendered lines from the bottom of the window upwards
         'outer: while item >= self.contents.first_index() &&
+            item < self.contents.index_limit() &&
             lines.len() + 1 < h
         {
             let rendered = self.rendered.get(&item)