Added check for null list