mirror of
https://github.com/trussed-dev/littlefs2.git
synced 2026-03-11 16:30:52 -07:00
Fix list panic when last block of the filesystem is used
This commit is contained in:
+1
-1
@@ -79,7 +79,7 @@ impl Storage for FileStorage {
|
||||
const BLOCK_COUNT: usize = BLOCK_COUNT;
|
||||
|
||||
fn read(&mut self, off: usize, buf: &mut [u8]) -> Result<usize> {
|
||||
assert!(off + buf.len() < BLOCK_SIZE * BLOCK_COUNT);
|
||||
assert!(off + buf.len() <= BLOCK_SIZE * BLOCK_COUNT);
|
||||
if off >= self.len {
|
||||
// blocks that are not in the file are assumed to be empty
|
||||
buf.iter_mut().for_each(|byte| *byte = 0);
|
||||
|
||||
Reference in New Issue
Block a user