소스 검색

Make curve interpolate crash less.

(cherry picked from commit d67c5afa95e3610e5c3db1c6a9850809eead3eb0)
K. S. Ernest (iFire) Lee 4 년 전
부모
커밋
42ad091738
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      modules/gltf/gltf_document.cpp

+ 2 - 0
modules/gltf/gltf_document.cpp

@@ -5644,6 +5644,8 @@ struct EditorSceneImporterGLTFInterpolate<Quat> {
 
 template <class T>
 T GLTFDocument::_interpolate_track(const Vector<float> &p_times, const Vector<T> &p_values, const float p_time, const GLTFAnimation::Interpolation p_interp) {
+	ERR_FAIL_COND_V(!p_values.size(), T());
+	ERR_FAIL_COND_V(p_times.size() != p_values.size(), p_values[0]);
 	//could use binary search, worth it?
 	int idx = -1;
 	for (int i = 0; i < p_times.size(); i++) {