mirror of
https://github.com/Relintai/mesh_data_resource.git
synced 2024-11-14 10:17:26 +01:00
Improve error checking in recompute_aabb.
This commit is contained in:
parent
5b9617bfaa
commit
02d51e87d6
@ -98,10 +98,22 @@ void MeshDataResource::set_collision_shapes(const Vector<Variant> &p_arrays) {
|
||||
}
|
||||
|
||||
void MeshDataResource::recompute_aabb() {
|
||||
if (_arrays.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Variant arr = _arrays[Mesh::ARRAY_VERTEX];
|
||||
|
||||
if (arr.get_type() != Variant::POOL_VECTOR3_ARRAY) {
|
||||
return;
|
||||
}
|
||||
|
||||
PoolVector<Vector3> vertices = arr;
|
||||
int len = vertices.size();
|
||||
ERR_FAIL_COND(len == 0);
|
||||
|
||||
if (len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
PoolVector<Vector3>::Read r = vertices.read();
|
||||
|
Loading…
Reference in New Issue
Block a user