Add NPE check to process