Corrected fix for #28722: Segfault when reading volumetric clouds example

Looks like with current implementation voxeldata should always be created
for voxel textures. Remove recently added NULL check and allocate
voxel data when linking a texture.
This commit is contained in:
Sergey Sharybin
2011-09-22 17:52:21 +00:00
parent 799afc1aa4
commit 2eb1339e3f
2 changed files with 4 additions and 1 deletions

View File

@@ -244,7 +244,7 @@ static struct Tex *tex_stepdata__internal(struct Tex *tex, const int step_next,
tex= tex->id.next;
while (tex) {
if (tex->type == TEX_VOXELDATA && tex->vd && TEX_VD_IS_SOURCE_PATH(tex->vd->file_format))
if (tex->type == TEX_VOXELDATA && TEX_VD_IS_SOURCE_PATH(tex->vd->file_format))
break;
/* image is not a image with a path, skip it */
tex= tex->id.next;

View File

@@ -3009,6 +3009,9 @@ static void direct_link_texture(FileData *fd, Tex *tex)
if(tex->vd) {
tex->vd->dataset = NULL;
tex->vd->ok = 0;
} else {
if(tex->type == TEX_VOXELDATA)
tex->vd= MEM_callocN(sizeof(VoxelData), "direct_link_texture VoxelData");
}
tex->nodetree= newdataadr(fd, tex->nodetree);