1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Fix error when "Toggle Files Panel" in shader editor

This commit is contained in:
Haoyu Qiu
2025-07-07 22:32:53 +08:00
parent 53be3b78d1
commit b9657ad198

View File

@@ -633,14 +633,16 @@ void ShaderEditorPlugin::_menu_item_pressed(int p_index) {
shader_list->set_visible(!shader_list->is_visible()); shader_list->set_visible(!shader_list->is_visible());
int index = shader_tabs->get_current_tab(); int index = shader_tabs->get_current_tab();
ERR_FAIL_INDEX(index, shader_tabs->get_tab_count()); if (index != -1) {
TextShaderEditor *editor = Object::cast_to<TextShaderEditor>(edited_shaders[index].shader_editor); ERR_FAIL_INDEX(index, (int)edited_shaders.size());
if (editor) { TextShaderEditor *editor = Object::cast_to<TextShaderEditor>(edited_shaders[index].shader_editor);
editor->get_code_editor()->update_toggle_files_button(); if (editor) {
} else { editor->get_code_editor()->update_toggle_files_button();
VisualShaderEditor *vs_editor = Object::cast_to<VisualShaderEditor>(edited_shaders[index].shader_editor); } else {
if (vs_editor) { VisualShaderEditor *vs_editor = Object::cast_to<VisualShaderEditor>(edited_shaders[index].shader_editor);
vs_editor->update_toggle_files_button(); if (vs_editor) {
vs_editor->update_toggle_files_button();
}
} }
} }
} break; } break;