Fix for BLI_ungzip_to_mem: it'll return NULL now if file is not found.
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 20 Sep 2011 14:49:12 +0000 (14:49 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 20 Sep 2011 14:49:12 +0000 (14:49 +0000)
It makes default bfont used if unifont isn't found. Useful for install-less
launch when debugging.

source/blender/blenlib/intern/fileops.c

index 6b125435b3142219f51c71cb0a481f5849ab80d3..9ccd7fbe12164ebb7adff730fd7fffd4009e4c6e 100644 (file)
@@ -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;