summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2020-12-01 13:15:31 +0300
committerGitHub <noreply@github.com>2020-12-01 13:15:31 +0300
commit339b64697cefce637b473cf8aee6df8bb7fe05d9 (patch)
tree998d0f3d6adb2fe80546c944e1b5da2566b964a5 /editor
parent04bef80b42408f45d7838f9ef29f0e0553957475 (diff)
parenta9e5701e2a8ac44589a4e882e4c50be5325bf597 (diff)
Merge pull request #44001 from Chaosus/vs_fix_preview_crash
Fixed crash in visual shader on changing input when preview is visible
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index b075eb83e4..17be057c00 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -120,9 +120,11 @@ void VisualShaderGraphPlugin::set_connections(List<VisualShader::Connection> &p_
}
void VisualShaderGraphPlugin::show_port_preview(VisualShader::Type p_type, int p_node_id, int p_port_id) {
- if (visual_shader->get_shader_type() == p_type && links.has(p_node_id)) {
+ if (visual_shader->get_shader_type() == p_type && links.has(p_node_id) && links[p_node_id].output_ports.has(p_port_id)) {
for (Map<int, Port>::Element *E = links[p_node_id].output_ports.front(); E; E = E->next()) {
- E->value().preview_button->set_pressed(false);
+ if (E->value().preview_button != nullptr) {
+ E->value().preview_button->set_pressed(false);
+ }
}
if (links[p_node_id].preview_visible && !is_dirty() && links[p_node_id].preview_box != nullptr) {
@@ -132,7 +134,7 @@ void VisualShaderGraphPlugin::show_port_preview(VisualShader::Type p_type, int p
links[p_node_id].preview_visible = false;
}
- if (p_port_id != -1) {
+ if (p_port_id != -1 && links[p_node_id].output_ports[p_port_id].preview_button != nullptr) {
if (is_dirty()) {
links[p_node_id].preview_pos = links[p_node_id].graph_node->get_child_count();
}