Prevent slide range overrun by checking the slide boundary.