From 8aedbd99f1b3c35054c3208f6de45589d26fbc90 Mon Sep 17 00:00:00 2001 From: Ettore Ricci Date: Thu, 4 Apr 2024 19:02:09 +0200 Subject: [PATCH] fixed a stupid error that made the address variable underflow when no file was open not noticeable in release but made the debug release crush --- src/app/cursor_position.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/cursor_position.rs b/src/app/cursor_position.rs index b49ed1c..d41fef3 100644 --- a/src/app/cursor_position.rs +++ b/src/app/cursor_position.rs @@ -184,7 +184,7 @@ impl <'a> App<'a> } if address >= self.data.len() { - address = self.data.len() - 1; + address = self.data.len().saturating_sub(1); } let expected_cursor_position = self.get_expected_cursor_position(address, false);