From a966068f09b7960959a01a1a79d82584aa0c9ad6 Mon Sep 17 00:00:00 2001 From: jsjtxietian Date: Sun, 27 Aug 2023 00:17:43 +0800 Subject: [PATCH] Fix _get_debug_tooltip will crash if tooltip string is too large (cherry picked from commit 155d738163d46333562f68ebb5d62f3ea2d95145) --- editor/plugins/script_editor_plugin.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 35cda31bb6b..4b379807b67 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -421,7 +421,11 @@ ScriptEditor *ScriptEditor::script_editor = nullptr; String ScriptEditor::_get_debug_tooltip(const String &p_text, Node *_se) { String val = EditorDebuggerNode::get_singleton()->get_var_value(p_text); + const int display_limit = 300; if (!val.is_empty()) { + if (val.size() > display_limit) { + val = val.left(display_limit) + " [...] truncated!"; + } return p_text + ": " + val; } else { return String();