Well, if you're getting a NPE when calling profile.getLocation() then the profile is null (there's nothing within the getLocation() method that could cause a NPE). But could it be that the NPE happens when trying to get the ID or name from the location Reference? If so, then the location itself is null...and it is possible that a profile not have a location, in which case a null is returned from getLocation().
I'm afraid that for lack of knowing exactly where the NPE happens, that's the most help I can offer.
Spring Social Project Lead