Add null check for onEntityEnterPortal