Skip to content

Commit 172fc62

Browse files
committed
Merge pull request godotengine#102698 from HolonProduction/no-null-safety
Autocompletion: Account for invalid annotations when making arghint
2 parents 65b8164 + 62eebf1 commit 172fc62

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

modules/gdscript/gdscript_editor.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,11 @@ static void _get_directory_contents(EditorFileSystemDirectory *p_dir, HashMap<St
889889
}
890890

891891
static void _find_annotation_arguments(const GDScriptParser::AnnotationNode *p_annotation, int p_argument, const String p_quote_style, HashMap<String, ScriptLanguage::CodeCompletionOption> &r_result, String &r_arghint) {
892-
r_arghint = _make_arguments_hint(p_annotation->info->info, p_argument, true);
892+
ERR_FAIL_NULL(p_annotation);
893+
894+
if (p_annotation->info != nullptr) {
895+
r_arghint = _make_arguments_hint(p_annotation->info->info, p_argument, true);
896+
}
893897
if (p_annotation->name == SNAME("@export_range")) {
894898
if (p_argument == 3 || p_argument == 4 || p_argument == 5) {
895899
// Slider hint.

modules/gdscript/gdscript_parser.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ class GDScriptParser {
372372
Vector<ExpressionNode *> arguments;
373373
Vector<Variant> resolved_arguments;
374374

375+
/** Information of the annotation. Might be null for unknown annotations. */
375376
AnnotationInfo *info = nullptr;
376377
PropertyInfo export_info;
377378
bool is_resolved = false;

0 commit comments

Comments
 (0)