mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 13:41:03 +00:00 
			
		
		
		
	Add checks after ResourceLoader::load()
This commit is contained in:
		
							parent
							
								
									daf4a9f9be
								
							
						
					
					
						commit
						0a0f596dfb
					
				
					 3 changed files with 4 additions and 0 deletions
				
			
		|  | @ -3230,6 +3230,7 @@ void SpatialEditorViewport::_create_preview(const Vector<String> &files) const { | |||
| 	for (int i = 0; i < files.size(); i++) { | ||||
| 		String path = files[i]; | ||||
| 		RES res = ResourceLoader::load(path); | ||||
| 		ERR_CONTINUE(res.is_null()); | ||||
| 		Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res)); | ||||
| 		Ref<Mesh> mesh = Ref<Mesh>(Object::cast_to<Mesh>(*res)); | ||||
| 		if (mesh != NULL || scene != NULL) { | ||||
|  | @ -3279,6 +3280,7 @@ bool SpatialEditorViewport::_cyclical_dependency_exists(const String &p_target_s | |||
| 
 | ||||
| bool SpatialEditorViewport::_create_instance(Node *parent, String &path, const Point2 &p_point) { | ||||
| 	RES res = ResourceLoader::load(path); | ||||
| 	ERR_FAIL_COND_V(res.is_null(), false); | ||||
| 
 | ||||
| 	Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res)); | ||||
| 	Ref<Mesh> mesh = Ref<Mesh>(Object::cast_to<Mesh>(*res)); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 lupoDharkael
						lupoDharkael