Fix _get_debug_tooltip will crash if tooltip string is too large

(cherry picked from commit 155d738163)
This commit is contained in:
jsjtxietian 2023-08-27 00:17:43 +08:00 committed by Yuri Sizov
parent 9c68648d72
commit a966068f09
1 changed files with 4 additions and 0 deletions

View File

@ -421,7 +421,11 @@ ScriptEditor *ScriptEditor::script_editor = nullptr;
String ScriptEditor::_get_debug_tooltip(const String &p_text, Node *_se) { String ScriptEditor::_get_debug_tooltip(const String &p_text, Node *_se) {
String val = EditorDebuggerNode::get_singleton()->get_var_value(p_text); String val = EditorDebuggerNode::get_singleton()->get_var_value(p_text);
const int display_limit = 300;
if (!val.is_empty()) { if (!val.is_empty()) {
if (val.size() > display_limit) {
val = val.left(display_limit) + " [...] truncated!";
}
return p_text + ": " + val; return p_text + ": " + val;
} else { } else {
return String(); return String();