Fix T51687: GPUmat evaluation of shader tree would crash uppon unknown/unsupported...
[blender.git] / source / blender / nodes / intern / node_exec.c
index 2347564c6965df2fecf94fdf40fb1f6f35157112..0cf131adbdccc4cd0455750d177172f23e5a54e3 100644 (file)
@@ -78,7 +78,8 @@ void node_get_stack(bNode *node, bNodeStack *stack, bNodeStack **in, bNodeStack
 
 static void node_init_input_index(bNodeSocket *sock, int *index)
 {
-       if (sock->link && sock->link->fromsock) {
+       /* Only consider existing link if from socket is valid! */
+       if (sock->link && sock->link->fromsock && sock->link->fromsock->stack_index >= 0) {
                sock->stack_index = sock->link->fromsock->stack_index;
        }
        else {