diff --git a/src/database/schema/commit.rs b/src/database/schema/commit.rs index 7454113..4c60a2e 100644 --- a/src/database/schema/commit.rs +++ b/src/database/schema/commit.rs @@ -189,7 +189,7 @@ impl CommitTree { pub fn fetch_latest_one(&self) -> Result, anyhow::Error> { let mut key = self.prefix.to_vec(); - key.extend_from_slice(&(self.len()? - 1).to_be_bytes()); + key.extend_from_slice(&(self.len()?.saturating_sub(1)).to_be_bytes()); let cf = self .db