Add null check to CollisionPolygon2D

It's `_update_xform_in_parent()` wasn't null-checking, while other colliders like `CollisionShape2D` were.

Fixes #17780.
This commit is contained in:
Pedro J. Estébanez 2018-03-27 19:33:28 +02:00
parent 3764cf6245
commit 00c308a8fa

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());
}
}
}
}