浏览代码

添加边界判断

leiyasi 1 年之前
父节点
当前提交
593df76c75
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      GameClient/Assets/Game/HotUpdate/Views/Friend/FriendView.cs

+ 2 - 0
GameClient/Assets/Game/HotUpdate/Views/Friend/FriendView.cs

@@ -246,7 +246,9 @@ namespace GFGGame
             int selectedIndex = 0;
             int selectedIndex = 0;
             if (_ui.m_list.numItems > 0)
             if (_ui.m_list.numItems > 0)
             {
             {
+                if (_ui.m_list.selectedIndex < 0) return;
                 _ui.m_list.ScrollToView(_ui.m_list.selectedIndex);
                 _ui.m_list.ScrollToView(_ui.m_list.selectedIndex);
+
                 int childIndex = _ui.m_list.ItemIndexToChildIndex(_ui.m_list.selectedIndex);
                 int childIndex = _ui.m_list.ItemIndexToChildIndex(_ui.m_list.selectedIndex);
                 if (childIndex < 0) return;
                 if (childIndex < 0) return;
                 GButton item = _ui.m_list.GetChildAt(childIndex).asButton.GetChild("btnSend").asButton;
                 GButton item = _ui.m_list.GetChildAt(childIndex).asButton.GetChild("btnSend").asButton;