prevent crash on NaN offset in path_follower 2d and 3d

This commit is contained in:
Hayden Leete 2022-06-01 17:08:11 +12:00
parent 5fec0d232a
commit fded50fced
2 changed files with 2 additions and 0 deletions

View file

@ -304,6 +304,7 @@ void PathFollow2D::_bind_methods() {
}
void PathFollow2D::set_offset(real_t p_offset) {
ERR_FAIL_COND(!isfinite(p_offset));
offset = p_offset;
if (path) {
if (path->get_curve().is_valid()) {

View file

@ -397,6 +397,7 @@ void PathFollow3D::_bind_methods() {
}
void PathFollow3D::set_offset(real_t p_offset) {
ERR_FAIL_COND(!isfinite(p_offset));
prev_offset = offset;
offset = p_offset;