[NUI] Fixed Svace issues
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / RecyclerView / GridRecycleLayoutManager.cs
old mode 100644 (file)
new mode 100755 (executable)
index abfa02d..b546abc
@@ -86,7 +86,10 @@ namespace Tizen.NUI.Components
         {
             bool result = false;
             View list = Container.GetParent() as View;
-
+            if (list == null)
+            {
+                return result;
+            }
             Vector2 visibleArea = new Vector2(Math.Abs(scrollPosition),
                 Math.Abs(scrollPosition) + (LayoutOrientation == Orientation.Vertical ?
                                                 list.Size.Width : list.Size.Height)
@@ -133,7 +136,7 @@ namespace Tizen.NUI.Components
             {
                 RecycleItem item = Container.Children[i] as RecycleItem;
 
-                if (previousItem != null)
+                if (previousItem != null && item != null)
                 {
                     item.Position = LayoutOrientation == Orientation.Vertical ?
                         new Position(
@@ -204,10 +207,13 @@ namespace Tizen.NUI.Components
                     for (int i = 0; i < itemInGroup; i++)
                     {
                         RecycleItem target = Container.Children[0] as RecycleItem;
-                        target.DataIndex = target.DataIndex + Container.Children.Count;
-                        target.SiblingOrder = Container.Children.Count - 1;
+                        if (target != null)
+                        {
+                            target.DataIndex = target.DataIndex + Container.Children.Count;
+                            target.SiblingOrder = Container.Children.Count - 1;
 
-                        result.Add(target);
+                            result.Add(target);
+                        }
                     }
                 }
             }
@@ -220,16 +226,18 @@ namespace Tizen.NUI.Components
                     for (int i = 0; i < itemInGroup; i++)
                     {
                         RecycleItem prevFirstItem = Container.Children[itemInGroup] as RecycleItem;
-
                         RecycleItem target = Container.Children[Container.Children.Count - 1] as RecycleItem;
-                        target.Position = new Position(
-                            LayoutOrientation == Orientation.Vertical ? (prevFirstItem.Position.X - target.Size.Width) : prevFirstItem.Position.X,
-                            LayoutOrientation == Orientation.Vertical ? prevFirstItem.Position.Y : (prevFirstItem.Position.Y - target.Size.Height)
-                        );
-                        target.DataIndex = target.DataIndex - Container.Children.Count;
-                        target.SiblingOrder = 0;
-
-                        result.Add(target);
+                        if (prevFirstItem != null && target != null)
+                        {
+                            target.Position = new Position(
+                                LayoutOrientation == Orientation.Vertical ? (prevFirstItem.Position.X - target.Size.Width) : prevFirstItem.Position.X,
+                                LayoutOrientation == Orientation.Vertical ? prevFirstItem.Position.Y : (prevFirstItem.Position.Y - target.Size.Height)
+                            );
+                            target.DataIndex = target.DataIndex - Container.Children.Count;
+                            target.SiblingOrder = 0;
+
+                            result.Add(target);
+                        }
                     }
                 }
             }
@@ -284,7 +292,7 @@ namespace Tizen.NUI.Components
             if(targetSibling > -1 && targetSibling < Container.Children.Count)
             {
                 RecycleItem candidate = Container.Children[targetSibling] as RecycleItem;
-                if(candidate.DataIndex >= 0 && candidate.DataIndex < DataCount)
+                if(candidate != null && candidate.DataIndex >= 0 && candidate.DataIndex < DataCount)
                 {
                     nextFocusedView = candidate;
                 }