Nodes: fix link drawing for some socket types

The type of sockets is `-1` in some cases, resulting in a crash
when accessing the `std_node_socket_colors` array.
This commit is contained in:
Jacques Lucke 2021-10-22 11:52:51 +02:00
parent 1133b1478e
commit 675a22b341
1 changed files with 3 additions and 1 deletions

View File

@ -4262,7 +4262,9 @@ void node_draw_link_bezier(const View2D *v2d,
}
if (snode->overlay.flag & SN_OVERLAY_SHOW_OVERLAYS &&
snode->overlay.flag & SN_OVERLAY_SHOW_WIRE_COLORS) {
snode->overlay.flag & SN_OVERLAY_SHOW_WIRE_COLORS &&
((link->fromsock == nullptr || link->fromsock->typeinfo->type >= 0) &&
(link->tosock == nullptr || link->tosock->typeinfo->type >= 0))) {
if (link->fromsock) {
copy_v4_v4(colors[1], std_node_socket_colors[link->fromsock->typeinfo->type]);
}