Merge pull request #41315 from clayjohn/Polygon2D-crash
Check arrays before generating Polygon2D AABBs
This commit is contained in:
commit
a10ae31c0f
|
@ -971,6 +971,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skeleton != RID()) {
|
if (skeleton != RID()) {
|
||||||
|
|
||||||
// calculate bone AABBs
|
// calculate bone AABBs
|
||||||
int bone_count = RasterizerStorage::base_singleton->skeleton_get_bone_count(skeleton);
|
int bone_count = RasterizerStorage::base_singleton->skeleton_get_bone_count(skeleton);
|
||||||
|
|
||||||
|
@ -981,6 +982,7 @@ public:
|
||||||
for (int j = 0; j < bone_count; j++) {
|
for (int j = 0; j < bone_count; j++) {
|
||||||
bptr[j].size = Vector2(-1, -1); //negative means unused
|
bptr[j].size = Vector2(-1, -1); //negative means unused
|
||||||
}
|
}
|
||||||
|
if (l && polygon->bones.size() == l * 4 && polygon->weights.size() == polygon->bones.size()) {
|
||||||
|
|
||||||
for (int j = 0; j < l; j++) {
|
for (int j = 0; j < l; j++) {
|
||||||
Point2 p = pp[j];
|
Point2 p = pp[j];
|
||||||
|
@ -1015,6 +1017,7 @@ public:
|
||||||
|
|
||||||
r = r.merge(aabb);
|
r = r.merge(aabb);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Item::Command::TYPE_MESH: {
|
case Item::Command::TYPE_MESH: {
|
||||||
|
|
Loading…
Reference in New Issue