Catch potential index errors.