Merge pull request #17804 from RandomShaper/fix-orphan-collider-crash-2.1

Add null check to CollisionPolygon2D
This commit is contained in:
Rémi Verschelde 2018-03-28 09:33:57 +02:00 committed by GitHub
commit 298548df4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,8 +98,10 @@ void CollisionPolygon2D::_update_xform_in_parent() {
if (shape_from >= 0 && shape_to >= 0) {
CollisionObject2D *co = get_parent()->cast_to<CollisionObject2D>();
for (int i = shape_from; i <= shape_to; i++) {
co->set_shape_transform(i, get_transform());
if (co) {
for (int i = shape_from; i <= shape_to; i++) {
co->set_shape_transform(i, get_transform());
}
}
}
}