浏览代码

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

Hayden Leete 3 年之前
父节点
当前提交
fded50fced
共有 2 个文件被更改,包括 2 次插入0 次删除
  1. 1 0
      scene/2d/path_2d.cpp
  2. 1 0
      scene/3d/path_3d.cpp

+ 1 - 0
scene/2d/path_2d.cpp

@@ -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()) {

+ 1 - 0
scene/3d/path_3d.cpp

@@ -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;