From cb26157880e475adc97104ef2954707bc8ec5628 Mon Sep 17 00:00:00 2001 From: Chris Desjardins Date: Mon, 30 Dec 2019 12:56:27 +0100 Subject: [PATCH] Change assert to runtime check. I had a system that was constantly hitting this assert, after making this change it recovered immediately. --- lfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lfs.c b/lfs.c index 7190312..0bb570c 100644 --- a/lfs.c +++ b/lfs.c @@ -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; }