Selaa lähdekoodia

Bugly 获得ViewManager界面GetUIView 时防止报错

huangxiaoyue 1 vuosi sitten
vanhempi
commit
365afa7bdc
1 muutettua tiedostoa jossa 6 lisäystä ja 4 poistoa
  1. 6 4
      GameClient/Assets/Game/HotUpdate/Views/ViewManager.cs

+ 6 - 4
GameClient/Assets/Game/HotUpdate/Views/ViewManager.cs

@@ -283,11 +283,13 @@ namespace GFGGame
         }
         public static IUIView GetUIView(string viewName)
         {
-            IUIView obj = _viewDic[viewName];
-            if (obj != null && obj.isShowing)
+            if (_viewDic.ContainsKey(viewName))
             {
-
-                return obj as IUIView;
+                IUIView obj = _viewDic[viewName];
+                if (obj != null && obj.isShowing)
+                {
+                    return obj as IUIView;
+                }
             }
             return null;
         }