Added NULL check for socket type make_socket_interface

Without this check it's easy to crash blender by passing
non-existing socket type to sockets.new() function.
This commit is contained in:
Sergey Sharybin
2013-06-13 11:49:22 +00:00
parent 65047099b2
commit eb136fcbec

View File

@@ -1999,7 +1999,11 @@ static bNodeSocket *make_socket_interface(bNodeTree *ntree, int in_out,
bNodeSocketType *stype = nodeSocketTypeFind(idname);
bNodeSocket *sock;
int own_index = ntree->cur_index++;
if (stype == NULL) {
return NULL;
}
sock = MEM_callocN(sizeof(bNodeSocket), "socket template");
BLI_strncpy(sock->idname, stype->idname, sizeof(sock->idname));
node_socket_set_typeinfo(ntree, sock, stype);