Fix for Output File node operators: added a sanity type check to avoid using invalid...
authorLukas Toenne <lukas.toenne@googlemail.com>
Sun, 6 Oct 2013 10:28:09 +0000 (10:28 +0000)
committerLukas Toenne <lukas.toenne@googlemail.com>
Sun, 6 Oct 2013 10:28:09 +0000 (10:28 +0000)
Reported by Sebastian Koenig in unrelated bug report #36968.

source/blender/editors/space_node/node_edit.c

index ff6a8e884a6dfe9fd43af0fde77f420f6ae111a5..bc0a518b1b00e7eaab3d71d6e35ded007c280be1 100644 (file)
@@ -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;