From 2af7bb8aaff41afffd336d4785713591e6f960eb Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 20 Sep 2011 14:49:12 +0000 Subject: [PATCH] Fix for BLI_ungzip_to_mem: it'll return NULL now if file is not found. It makes default bfont used if unifont isn't found. Useful for install-less launch when debugging. --- source/blender/blenlib/intern/fileops.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 6b125435b31..9ccd7fbe121 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -136,7 +136,11 @@ char *BLI_ungzip_to_mem(const char *from_file, int *size_r) else break; } - if(mem && alloc_size!=size) + if(size==0) { + MEM_freeN(mem); + mem= NULL; + } + else if(alloc_size!=size) mem= MEM_reallocN(mem, size); *size_r= size;