Make curve interpolate crash less.

(cherry picked from commit d67c5afa95)
This commit is contained in:
K. S. Ernest (iFire) Lee 2021-05-21 10:47:24 -07:00 committed by Rémi Verschelde
parent e74ee7294e
commit 42ad091738
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -5644,6 +5644,8 @@ struct EditorSceneImporterGLTFInterpolate<Quat> {
template <class T> 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) { 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? //could use binary search, worth it?
int idx = -1; int idx = -1;
for (int i = 0; i < p_times.size(); i++) { for (int i = 0; i < p_times.size(); i++) {