Problem with pic_small?

Dec 13, 2008 at 9:12 PM
I have a facebook application that puts images in a gridiview using the pic_small property of the user class. Locally (my dev box) this is fine. When I run this on my hosting provider it throws a null reference exception... Am I doing something wrong?

 

 

 

if (faceBookSvc == null)

 

{

 

throw new ArgumentNullException("faceBookSvc");

 

}

 

if (faceBookSvc.API == null)

 

{

 

throw new ArgumentNullException("API");

 

}

 

if (faceBookSvc.API.users == null)

 

{

 

throw new ArgumentNullException("users");

 

}

 

if (string.IsNullOrEmpty(Anonymous))

 

{

 

throw new ArgumentException("Anonymous");

 

}

 

string imageURL = faceBookSvc.API.users.getInfo(uid).pic_small

 

 

bool emptyString = string.IsNullOrEmpty(imageURL);

 

 

 

return (!emptyString) ? imageURL : Anonymous;

 

Dec 15, 2008 at 5:11 AM
This problem halfway resolved itself. It seems that occassionally FaceBook cannot serve up user information and the reference to pic_small was failing because the call to getinfo was returning null. I added more robust error handling so only individual users profile pictures don't show up instead of crashing the entire app.