Browse Source

Fix gdscript-parser crash

Fixes gdscript-parser crashing while printing empty identifiers.
cdemirer 3 years ago
parent
commit
3033e0f8a2
1 changed files with 5 additions and 1 deletions
  1. 5 1
      modules/gdscript/gdscript_parser.cpp

+ 5 - 1
modules/gdscript/gdscript_parser.cpp

@@ -4221,7 +4221,11 @@ void GDScriptParser::TreePrinter::print_get_node(GetNodeNode *p_get_node) {
 }
 }
 
 
 void GDScriptParser::TreePrinter::print_identifier(IdentifierNode *p_identifier) {
 void GDScriptParser::TreePrinter::print_identifier(IdentifierNode *p_identifier) {
-	push_text(p_identifier->name);
+	if (p_identifier != nullptr) {
+		push_text(p_identifier->name);
+	} else {
+		push_text("<invalid identifier>");
+	}
 }
 }
 
 
 void GDScriptParser::TreePrinter::print_if(IfNode *p_if, bool p_is_elif) {
 void GDScriptParser::TreePrinter::print_if(IfNode *p_if, bool p_is_elif) {