From 2a02f44ad959ed3ac24a36688c74a1284c9a8a74 Mon Sep 17 00:00:00 2001 From: Hein-Pieter van Braam Date: Sun, 12 Aug 2018 22:33:35 +0200 Subject: [PATCH] Don't try to update the visual shader graph if it doesn't exist yet When setting shader mode on a visual shader that was just created in the editor we try to _update_graph(). However, the graph does not yet exist in the visualshadereditor. This gets populated in VisualShaderEditor::edit() which hasn't been called yet. This PR simply changes the logic to not try to update the non-existent graph. This fixes #20322 --- editor/plugins/visual_shader_editor_plugin.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 9218fed9076..63e89b78ea4 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -119,6 +119,9 @@ void VisualShaderEditor::_update_graph() { if (updating) return; + if (visual_shader.is_null()) + return; + graph->set_scroll_ofs(visual_shader->get_graph_offset() * EDSCALE); VisualShader::Type type = VisualShader::Type(edit_type->get_selected());