summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitchell Hynes <mitchell.hynes@ecumene.xyz>2019-10-14 17:08:24 -0400
committerTim Oram <dev@mitmaro.ca>2019-10-17 17:41:51 -0230
commita2d595877fe01cd828a3407aed275803d31a0f7c (patch)
tree09c609f817b4bc3ab4ccb5fa7be25a652bcbc680
parentabbc2011e87654fcb952d81aa89be7bafba91f2a (diff)
Fixed a crash on scrolling
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/show_commit/data.rs2
2 files changed, 2 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 43013dc..b6d2175 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Missing ncursesw dependency listing for deb build
- Performance issue with show commit
- Visual mode index error when changing action or swapping lines
+- Fixed crash with scrolling to max length
### Removed
- Unused `errorColor` configuration
diff --git a/src/show_commit/data.rs b/src/show_commit/data.rs
index fa16e7d..65943e0 100644
--- a/src/show_commit/data.rs
+++ b/src/show_commit/data.rs
@@ -140,7 +140,7 @@ impl Data {
pub fn get_max_line_length(&self, start: usize, end: usize) -> usize {
let mut max_length = 0;
- for len in self.line_lengths[start..=end].iter() {
+ for len in self.line_lengths[start..=end.min(self.line_lengths.len() - 1)].iter() {
if *len > max_length {
max_length = *len;
}