Merge pull request #68952 from Chaosus/gds_fix_completion_crash

Fix GDScript completion crash
This commit is contained in:
Rémi Verschelde 2022-11-21 15:24:07 +01:00
commit 9ecb39fc23
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -2512,7 +2512,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
} }
static bool _get_subscript_type(GDScriptParser::CompletionContext &p_context, const GDScriptParser::SubscriptNode *p_subscript, GDScriptParser::DataType &r_base_type, Variant *r_base = nullptr) { static bool _get_subscript_type(GDScriptParser::CompletionContext &p_context, const GDScriptParser::SubscriptNode *p_subscript, GDScriptParser::DataType &r_base_type, Variant *r_base = nullptr) {
if (p_subscript->base->type == GDScriptParser::Node::IDENTIFIER) { if (p_subscript->base->type == GDScriptParser::Node::IDENTIFIER && p_context.base != nullptr) {
const GDScriptParser::GetNodeNode *get_node = nullptr; const GDScriptParser::GetNodeNode *get_node = nullptr;
const GDScriptParser::IdentifierNode *identifier_node = static_cast<GDScriptParser::IdentifierNode *>(p_subscript->base); const GDScriptParser::IdentifierNode *identifier_node = static_cast<GDScriptParser::IdentifierNode *>(p_subscript->base);