Announcement Announcement Module
No announcement yet.
getLocation() Reference Object null Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • getLocation() Reference Object null

    Hi there!

    I'm trying to get a Location Object, but is returning a null object. The code is above:

    FacebookProfile profile = facebook.userOperations().getUserProfile();
    Reference reference = profile.getLocation();

    The error: java.lang.NullPointerException

    If anyone could help, thanks.

  • #2
    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.