check if name is null or empty, then throw npe.