Skip to content

Commit

Permalink
Merge pull request godotengine#21 from ramatakinc/kyle/fix-search-hel…
Browse files Browse the repository at this point in the history
…p-crash

Fix crashing search help issue(s)
  • Loading branch information
hpvb authored Jul 31, 2023
2 parents ca375bd + d5ff2d2 commit f34c32e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions editor/editor_help_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ bool EditorHelpSearch::Runner::_phase_match_classes_init() {
}

bool EditorHelpSearch::Runner::_phase_match_classes() {
if (!iterator_doc) {
return true;
}

DocData::ClassDoc &class_doc = iterator_doc->value();
if (!_is_class_disabled_by_feature_profile(class_doc.name)) {
matches[class_doc.name] = ClassMatch();
Expand Down Expand Up @@ -387,6 +391,10 @@ bool EditorHelpSearch::Runner::_phase_class_items_init() {
}

bool EditorHelpSearch::Runner::_phase_class_items() {
if (!iterator_match) {
return true;
}

ClassMatch &match = iterator_match->value();

if (search_flags & SEARCH_SHOW_HIERARCHY) {
Expand All @@ -410,8 +418,16 @@ bool EditorHelpSearch::Runner::_phase_member_items_init() {
}

bool EditorHelpSearch::Runner::_phase_member_items() {
if (!iterator_match) {
return true;
}

ClassMatch &match = iterator_match->value();

if (match.doc == NULL) {
return true;
}

TreeItem *parent = (search_flags & SEARCH_SHOW_HIERARCHY) ? class_items[match.doc->name] : root_item;
for (int i = 0; i < match.methods.size(); i++) {
_create_method_item(parent, match.doc, match.methods[i]);
Expand Down Expand Up @@ -467,6 +483,10 @@ void EditorHelpSearch::Runner::_match_item(TreeItem *p_item, const String &p_tex
}

TreeItem *EditorHelpSearch::Runner::_create_class_hierarchy(const ClassMatch &p_match) {
if (p_match.doc == NULL) {
return NULL;
}

if (class_items.has(p_match.doc->name)) {
return class_items[p_match.doc->name];
}
Expand Down

0 comments on commit f34c32e

Please sign in to comment.