Prevent possible crash when mesh is freed
This commit is contained in:
parent
09e12ba9b4
commit
3dc1a1dbfb
2 changed files with 4 additions and 0 deletions
|
@ -64,6 +64,8 @@ void MeshStorage::mesh_free(RID p_rid) {
|
|||
mesh_clear(p_rid);
|
||||
mesh_set_shadow_mesh(p_rid, RID());
|
||||
Mesh *mesh = mesh_owner.get_or_null(p_rid);
|
||||
ERR_FAIL_COND(!mesh);
|
||||
|
||||
mesh->dependency.deleted_notify(p_rid);
|
||||
if (mesh->instances.size()) {
|
||||
ERR_PRINT("deleting mesh with active instances");
|
||||
|
|
|
@ -210,6 +210,8 @@ void MeshStorage::mesh_free(RID p_rid) {
|
|||
mesh_clear(p_rid);
|
||||
mesh_set_shadow_mesh(p_rid, RID());
|
||||
Mesh *mesh = mesh_owner.get_or_null(p_rid);
|
||||
ERR_FAIL_COND(!mesh);
|
||||
|
||||
mesh->dependency.deleted_notify(p_rid);
|
||||
if (mesh->instances.size()) {
|
||||
ERR_PRINT("deleting mesh with active instances");
|
||||
|
|
Loading…
Reference in a new issue