fix handling empty files

This commit is contained in:
alice pellerin
2026-03-18 19:18:08 -05:00
parent 0a98df9000
commit a699c0a371
6 changed files with 59 additions and 37 deletions
+6 -1
View File
@@ -183,10 +183,15 @@ impl App {
false
}
}
// returns 0 if empty
pub const fn max_contents_index(&self) -> usize {
self.contents.len().saturating_sub(1)
}
}
fn nybble_from_hex(hex: char) -> Option<u8> {
if !hex.is_ascii() { return None }
if !hex.is_ascii() { return None; }
match hex {
'0'..='9' => Some(u8::try_from(hex).unwrap() - u8::try_from('0').unwrap()),