Added null check on .tpe