diff --git a/native/jni/src/proximity_info_state.cpp b/native/jni/src/proximity_info_state.cpp index b9fce5fef..c5f2884c6 100644 --- a/native/jni/src/proximity_info_state.cpp +++ b/native/jni/src/proximity_info_state.cpp @@ -464,8 +464,8 @@ float ProximityInfoState::calculateNormalizedSquaredDistance( } int ProximityInfoState::getDuration(const int index) const { - if (mInputSize > 0 && index > 0 && index < mInputSize - 1) { - return mTimes[index + 1] - mTimes[index - 1]; + if (mInputSize > 0 && index >= 0 && index < mInputSize - 1) { + return mTimes[index + 1] - mTimes[index]; } return 0; }