Fix #148061: Prevent unknown socket type from crashing when reading file
`socket.socket_typeinfo()` can be nullptr when reading blend files that contains custom socket types that are not registered yet. This fix prevents crashing when this happenes (but the socket will stay unregistered). Pull Request: https://projects.blender.org/blender/blender/pulls/148103
This commit is contained in:
@@ -603,8 +603,8 @@ static void item_read_data(BlendDataReader *reader, bNodeTreeInterfaceItem &item
|
|||||||
|
|
||||||
/* Improve forward compatibility for unknown default input types. */
|
/* Improve forward compatibility for unknown default input types. */
|
||||||
const bNodeSocketType *stype = socket.socket_typeinfo();
|
const bNodeSocketType *stype = socket.socket_typeinfo();
|
||||||
if (!nodes::socket_type_supports_default_input_type(
|
if (!stype || !nodes::socket_type_supports_default_input_type(
|
||||||
*stype, NodeDefaultInputType(socket.default_input)))
|
*stype, NodeDefaultInputType(socket.default_input)))
|
||||||
{
|
{
|
||||||
socket.default_input = NODE_DEFAULT_INPUT_VALUE;
|
socket.default_input = NODE_DEFAULT_INPUT_VALUE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user