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:
parent
3764cf6245
commit
00c308a8fa
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user