Change assert to runtime check.

I had a system that was constantly hitting this assert, after making
this change it recovered immediately.
This commit is contained in:
Chris Desjardins
2019-12-30 12:56:27 +01:00
committed by Christopher Haster
parent a7dfae4526
commit cb26157880

3
lfs.c
View File

@@ -29,8 +29,7 @@ static int lfs_bd_read(lfs_t *lfs,
lfs_block_t block, lfs_off_t off,
void *buffer, lfs_size_t size) {
uint8_t *data = buffer;
LFS_ASSERT(block != LFS_BLOCK_NULL);
if (off+size > lfs->cfg->block_size) {
if ((off+size > lfs->cfg->block_size) || (block == LFS_BLOCK_NULL)) {
return LFS_ERR_CORRUPT;
}