From eb5b0d013f22ae0f56d95732b4f0cbacb37b0ce6 Mon Sep 17 00:00:00 2001 From: Vignesh1-art Date: Sat, 14 Aug 2021 21:58:07 +0530 Subject: [PATCH] Fixed crash executing TextEdit.new().set_draw_control_chars(true) Fixes #51613. --- scene/gui/text_edit.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 745920fcdd3e..a2c5769947da 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -4332,7 +4332,9 @@ bool TextEdit::is_highlight_all_occurrences_enabled() const { void TextEdit::set_draw_control_chars(bool p_draw_control_chars) { if (draw_control_chars != p_draw_control_chars) { draw_control_chars = p_draw_control_chars; - menu->set_item_checked(menu->get_item_index(MENU_DISPLAY_UCC), draw_control_chars); + if (menu) { + menu->set_item_checked(menu->get_item_index(MENU_DISPLAY_UCC), draw_control_chars); + } text.set_draw_control_chars(draw_control_chars); text.invalidate_all(); update();