forked from bartvdbraak/blender
Fix segfault with bad setting in the Image node.
The limit in the UI tooltips to set the amount of images used in animation allow the zero value, that cause a segfault. This commit fix the UI, add a init value of 1 to the node and also check in case that node_composit_get_image return NULL.
This commit is contained in:
parent
5f3e8c3fb6
commit
274543627a
@ -202,6 +202,7 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **in, b
|
||||
else {
|
||||
stackbuf= node_composit_get_image(rd, ima, iuser);
|
||||
|
||||
if (stackbuf) {
|
||||
/*respect image premul option*/
|
||||
if (stackbuf->type==CB_RGBA && ima->flag & IMA_DO_PREMUL) {
|
||||
int i;
|
||||
@ -227,6 +228,7 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **in, b
|
||||
if(out[2]->hasoutput)
|
||||
out[2]->data= node_composit_get_zimage(node, rd);
|
||||
}
|
||||
}
|
||||
|
||||
/* alpha and preview for both types */
|
||||
if(stackbuf) {
|
||||
@ -242,6 +244,7 @@ static void node_composit_init_image(bNode* node)
|
||||
{
|
||||
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
|
||||
node->storage= iuser;
|
||||
iuser->frames= 1;
|
||||
iuser->sfra= 1;
|
||||
iuser->fie_ima= 2;
|
||||
iuser->ok= 1;
|
||||
|
@ -1004,7 +1004,7 @@ static int node_composit_buts_image(uiBlock *block, bNodeTree *ntree, bNode *nod
|
||||
dy-= 19;
|
||||
uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "Frs:",
|
||||
xmin, dy, width, 19,
|
||||
&iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Amount of images used in animation");
|
||||
&iuser->frames, 1.0, MAXFRAMEF, 0, 0, "Amount of images used in animation");
|
||||
uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "SFra:",
|
||||
xmin+width, dy, width, 19,
|
||||
&iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Start frame of animation");
|
||||
|
Loading…
Reference in New Issue
Block a user