check null while checking list index