summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/mesh.cpp4
-rw-r--r--scene/resources/packed_scene.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 13721191c0..0599920303 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -75,6 +75,7 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const {
continue;
Array a = surface_get_arrays(i);
+ ERR_FAIL_COND_V(a.empty(), Ref<TriangleMesh>());
int vc = surface_get_array_len(i);
PoolVector<Vector3> vertices = a[ARRAY_VERTEX];
@@ -234,6 +235,7 @@ Ref<Shape> Mesh::create_convex_shape() const {
for (int i = 0; i < get_surface_count(); i++) {
Array a = surface_get_arrays(i);
+ ERR_FAIL_COND_V(a.empty(), Ref<ConvexPolygonShape>());
PoolVector<Vector3> v = a[ARRAY_VERTEX];
vertices.append_array(v);
}
@@ -273,6 +275,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
continue;
Array a = surface_get_arrays(i);
+ ERR_FAIL_COND_V(a.empty(), Ref<ArrayMesh>());
if (i == 0) {
arrays = a;
@@ -378,6 +381,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
PoolVector<Vector3>::Write r = vertices.write();
if (indices.size()) {
+ ERR_FAIL_COND_V(indices.size() % 3 != 0, Ref<ArrayMesh>());
vc = indices.size();
ir = indices.write();
has_indices = true;
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 978d81d5c2..3e7d350eec 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -1099,11 +1099,11 @@ void SceneState::set_bundled_scene(const Dictionary &p_dictionary) {
const int node_count = p_dictionary["node_count"];
const PoolVector<int> snodes = p_dictionary["nodes"];
- ERR_FAIL_COND(snodes.size() != node_count);
+ ERR_FAIL_COND(snodes.size() < node_count);
const int conn_count = p_dictionary["conn_count"];
const PoolVector<int> sconns = p_dictionary["conns"];
- ERR_FAIL_COND(sconns.size() != conn_count);
+ ERR_FAIL_COND(sconns.size() < conn_count);
PoolVector<String> snames = p_dictionary["names"];
if (snames.size()) {