mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-30 21:21:10 +00:00 
			
		
		
		
	Avoid crash after a parsing error in GDScript
This commit is contained in:
		
							parent
							
								
									7c79e361f5
								
							
						
					
					
						commit
						10c9c2ccd4
					
				
					 2 changed files with 4 additions and 9 deletions
				
			
		|  | @ -51,7 +51,9 @@ GDScriptParser *GDScriptParserRef::get_parser() const { | ||||||
| Error GDScriptParserRef::raise_status(Status p_new_status) { | Error GDScriptParserRef::raise_status(Status p_new_status) { | ||||||
| 	ERR_FAIL_COND_V(parser == nullptr, ERR_INVALID_DATA); | 	ERR_FAIL_COND_V(parser == nullptr, ERR_INVALID_DATA); | ||||||
| 
 | 
 | ||||||
| 	Error result = OK; | 	if (result != OK) { | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	while (p_new_status > status) { | 	while (p_new_status > status) { | ||||||
| 		switch (status) { | 		switch (status) { | ||||||
|  | @ -86,14 +88,6 @@ Error GDScriptParserRef::raise_status(Status p_new_status) { | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		if (result != OK) { | 		if (result != OK) { | ||||||
| 			if (parser != nullptr) { |  | ||||||
| 				memdelete(parser); |  | ||||||
| 				parser = nullptr; |  | ||||||
| 			} |  | ||||||
| 			if (analyzer != nullptr) { |  | ||||||
| 				memdelete(analyzer); |  | ||||||
| 				analyzer = nullptr; |  | ||||||
| 			} |  | ||||||
| 			return result; | 			return result; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -54,6 +54,7 @@ private: | ||||||
| 	GDScriptParser *parser = nullptr; | 	GDScriptParser *parser = nullptr; | ||||||
| 	GDScriptAnalyzer *analyzer = nullptr; | 	GDScriptAnalyzer *analyzer = nullptr; | ||||||
| 	Status status = EMPTY; | 	Status status = EMPTY; | ||||||
|  | 	Error result = OK; | ||||||
| 	String path; | 	String path; | ||||||
| 
 | 
 | ||||||
| 	friend class GDScriptCache; | 	friend class GDScriptCache; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Pedro J. Estébanez
						Pedro J. Estébanez