From 7c4f2b658821bb7fd561fb275682b5b9fd323e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 11 Feb 2025 22:01:22 +0100 Subject: [PATCH] EditorHelpBit: Workaround crash renaming named class inheriting `@tool` class This only addresses the symptom, not the root cause of the problem. In the MRP of the linked issue, the parent class seems to not be found in DocData after renaming its child class, which seems weird. Force opening the docs of the parent class can work it around, so we seem to have inconsistent state. Changed the same code in EditorHelp for good measure. Fixes #102718. --- editor/editor_help.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index a577098168d..0b6e817754e 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1017,7 +1017,8 @@ void EditorHelp::_update_doc() { class_desc->add_text(nbsp); // Otherwise icon borrows hyperlink from `_add_type()`. _add_type(inherits); - inherits = doc->class_list[inherits].inherits; + const DocData::ClassDoc *base_class_doc = doc->class_list.getptr(inherits); + inherits = base_class_doc ? base_class_doc->inherits : String(); if (!inherits.is_empty()) { class_desc->add_text(" < "); @@ -3713,7 +3714,8 @@ void EditorHelpBit::_update_labels() { _add_type_to_title({ inherits, String(), false }); - inherits = class_list[inherits].inherits; + const DocData::ClassDoc *base_class_doc = class_list.getptr(inherits); + inherits = base_class_doc ? base_class_doc->inherits : String(); } title->pop(); // font_size