Error when changing UI Image Sprite

Hi, Im using a code to Login with facebook, and it’s working. The problem is that when I’m trying to get the user’s profile picture I can’t change the UI Image Sprite.

This is the error that I’m Getting:

!hasError
UnityEngine.Sprite:Create(Texture2D, Rect, Vector2)
FbInit:getProfilePictures(FBResult) (at Assets/FACEBOOKTEST/FbInit.cs:110)
Facebook.c__Iterator0:MoveNext()

And this is My code:
The problem is my function called: “getProfilePictures”

I’d really appreciate your help, Thanks.

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;


public class FbInit : MonoBehaviour {
	

	public GameObject UIFBIsLoggedIn;
	public GameObject UIFBNotLoggedIn;

	public GameObject UIFBAvatar;
	public GameObject UIFBUserName;

	public Sprite profileImg;


	private Dictionary<string,string> profile = null;

	// Use this for initialization
	void Start () 
	{
		FB.Init(SetInit, onHideUnity);
	}

	private void SetInit()
	{
		Debug.Log ("FB Init Done");

		if (FB.IsLoggedIn) {

			Debug.Log("Fb Login");
			FBMenus(true);

		} else {
		
			//FBlogin();
			FBMenus(false);
		}
	}

	private void onHideUnity(bool isGameShown)
	{
		if(!isGameShown)
		{
			Time.timeScale = 0;

		}else{
			Time.timeScale = 1;

		}
	}

	public void FBlogin()
	{
		FB.Login ("email", AuthCallback);
	}

	void AuthCallback (FBResult result)
	{
		if(FB.IsLoggedIn)
		{
			Debug.Log("FB login Worked");
			FBMenus(true);

			//Get Profile Picture
			FB.API(Util.GetPictureURL("me",128,128), Facebook.HttpMethod.GET, getProfilePictures);

			//Get Username


			FB.API("/me?fields=id,first_name", Facebook.HttpMethod.GET, getUserName);
		}else{
			Debug.Log("FB login Failed");
			FBMenus(false);
		}
	}

	void FBMenus(bool IsLoggedIn)
	{
		if(IsLoggedIn)
		{
			UIFBIsLoggedIn.SetActive(true);
			UIFBNotLoggedIn.SetActive(false);
		}else{
			UIFBIsLoggedIn.SetActive(false);
			UIFBNotLoggedIn.SetActive(true);
		}
	}

	void getProfilePictures(FBResult result)
		
		
	{
		if(result.Error != null)
		{
			
			Debug.Log ("Problem Getting Profile Image");
			//Get Profile Image
			FB.API(Util.GetPictureURL("me",128,128), Facebook.HttpMethod.GET, getProfilePictures);

			//Get UserNAme


		}


		Image userAvatar = UIFBAvatar.GetComponent<Image> ();
		userAvatar.sprite = Sprite.Create (result.Texture, new Rect(0,0,128,128), new Vector2 (0, 0));

	
	}

	void getUserName(FBResult result)
	{
		if(result.Error != null)
		{
			Debug.Log("Error Getting Name");
			FB.API("/me?fields=id,first_name", Facebook.HttpMethod.GET, getUserName);
			return;
		}

		profile = Util.DeserializeJSONProfile (result.Text);
		Text UserMsg = UIFBUserName.GetComponent<Text> ();

		UserMsg.text = "Hello, " + profile ["first_name"];
	}
}

Do you know how the Texture2D is being created?

I’m loading a remote JPG and was getting this error until I changed the format to RGB24.

I was using:

Texture2D texture = new Texture2D(2, 2, TextureFormat.DXT1, false);

I changed it to:

Texture2D texture = new Texture2D(2, 2, TextureFormat.RGB24, false);