diff options
Diffstat (limited to 'src/nvim/memfile.c')
-rw-r--r-- | src/nvim/memfile.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c index 51fa17384c..3eac44b40b 100644 --- a/src/nvim/memfile.c +++ b/src/nvim/memfile.c @@ -300,7 +300,12 @@ bhdr_T *mf_get(memfile_T *mfp, blocknr_T nr, unsigned page_count) // could check here if the block is in the free list - hp = mf_alloc_bhdr(mfp, page_count); + if (page_count > 0) { + hp = mf_alloc_bhdr(mfp, page_count); + } + if (hp == NULL) { + return NULL; + } hp->bh_bnum = nr; hp->bh_flags = 0; |