Add null check to location