Check for potential index out of bounds exception. GH-166