Moved check for null list into function, so that changes after script
loading are not ignored.