Fix for Output File node operators: added a sanity type check to avoid using invalid node data.

Reported by Sebastian Koenig in unrelated bug report #36968.
This commit is contained in:
Lukas Toenne 2013-10-06 10:28:09 +00:00
parent e9d03296c7
commit 46a1d921f1

@ -1731,7 +1731,7 @@ static int node_output_file_add_socket_exec(bContext *C, wmOperator *op)
node = nodeGetActive(snode->edittree);
}
if (!node)
if (!node || node->type != CMP_NODE_OUTPUT_FILE)
return OPERATOR_CANCELLED;
RNA_string_get(op->ptr, "file_path", file_path);
@ -1777,7 +1777,7 @@ static int node_output_file_remove_active_socket_exec(bContext *C, wmOperator *U
node = nodeGetActive(snode->edittree);
}
if (!node)
if (!node || node->type != CMP_NODE_OUTPUT_FILE)
return OPERATOR_CANCELLED;
if (!ntreeCompositOutputFileRemoveActiveSocket(ntree, node))
@ -1819,7 +1819,7 @@ static int node_output_file_move_active_socket_exec(bContext *C, wmOperator *op)
else if (snode && snode->edittree)
node = nodeGetActive(snode->edittree);
if (!node)
if (!node || node->type != CMP_NODE_OUTPUT_FILE)
return OPERATOR_CANCELLED;
nimf = node->storage;