Add NPE check.