while doing leg press yesterday in the gym one of my buddies watched me for a minute then told me after my set that i should not lock out during the leg press because it puts too much pressure on the cartilege in the knees

is this true? and if so, how do i avoid locking out? just go high enough to keep my legs slightly bent?