فهرست منبع

空地址图片不加载

lvjincheng 2 سال پیش
والد
کامیت
5f62b20b61
1فایلهای تغییر یافته به همراه5 افزوده شده و 2 حذف شده
  1. 5 2
      Assets/BowArrow/Scripts/Manager/RoleMgr.cs

+ 5 - 2
Assets/BowArrow/Scripts/Manager/RoleMgr.cs

@@ -49,8 +49,11 @@ public class RoleMgr
     private static Dictionary<string, Sprite> remoteAvatarMap = new Dictionary<string, Sprite>();
     private static IEnumerator LoadAvatar(string url, Image image)
     {
-        if (url == null) url = "";
-        Debug.Log(remoteAvatarMap.Count);
+        if (string.IsNullOrWhiteSpace(url))
+        {
+            image.sprite = null;
+            yield break;
+        }
         if (remoteAvatarMap.ContainsKey(url))
         {
             image.sprite = remoteAvatarMap[url];