diff --git a/native/jni/src/proximity_info_state.cpp b/native/jni/src/proximity_info_state.cpp index b9fce5fef25d34cd8bd7895fed2561891a0fca6f..c5f2884c65bdb7f861825f40df975568ffe4945d 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; }