فهرست منبع

-fixed crash reported by n-pigeon

Juan Linietsky 10 سال پیش
والد
کامیت
fd4648c081
2فایلهای تغییر یافته به همراه12 افزوده شده و 1 حذف شده
  1. 1 1
      modules/gdscript/gd_editor.cpp
  2. 11 0
      modules/gdscript/gd_parser.cpp

+ 1 - 1
modules/gdscript/gd_editor.cpp

@@ -1165,7 +1165,7 @@ static void _find_identifiers(GDCompletionContext& context,int p_line,bool p_onl
 
 	const GDParser::ClassNode *clss=context._class;
 
-	bool _static=context.function->_static;
+	bool _static=context.function && context.function->_static;
 
 	while(clss) {
 		GDCompletionContext c = context;

+ 11 - 0
modules/gdscript/gd_parser.cpp

@@ -2757,6 +2757,9 @@ Error GDParser::parse_bytecode(const Vector<uint8_t> &p_bytecode,const String& p
 	completion_class=NULL;
 	completion_function=NULL;
 	completion_block=NULL;
+	current_block=NULL;
+	current_class=NULL;
+	current_function=NULL;
 
 	self_path=p_self_path;
 	GDTokenizerBuffer *tb = memnew( GDTokenizerBuffer );
@@ -2776,6 +2779,10 @@ Error GDParser::parse(const String& p_code, const String& p_base_path, bool p_ju
 	completion_class=NULL;
 	completion_function=NULL;
 	completion_block=NULL;
+	current_block=NULL;
+	current_class=NULL;
+
+	current_function=NULL;
 
 	self_path=p_self_path;
 	GDTokenizerText *tt = memnew( GDTokenizerText );
@@ -2811,6 +2818,10 @@ void GDParser::clear() {
 	completion_class=NULL;
 	completion_function=NULL;
 	completion_block=NULL;
+	current_block=NULL;
+	current_class=NULL;
+
+	current_function=NULL;
 
 	validating=false;
 	error_set=false;