Add check to update the current frame when needed

The current frame will not be updated past the maximum value defined by
the maximum trajectory length.