[NUI] Fix svace issue of RecyclerView LinearLayouter (#3924)
authorEunki Hong <h.pichulia@gmail.com>
Thu, 3 Feb 2022 08:21:00 +0000 (17:21 +0900)
committerGitHub <noreply@github.com>
Thu, 3 Feb 2022 08:21:00 +0000 (17:21 +0900)
Check if groupInfo is null. It can be null when count = 0.

Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
Co-authored-by: Eunki, Hong <eunkiki.hong@samsung.com>
src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/LinearLayouter.cs

index b6234a4..8ac2ff0 100755 (executable)
@@ -792,28 +792,35 @@ namespace Tizen.NUI.Components
                     }
                 }
 
-                if (parentIndex >= groups.Count)
+                if (groupInfo != null)
                 {
-                    groupInfo.GroupPosition = ScrollContentSize;
-                    groups.Add(groupInfo);
-                }
-                else
-                {
-                    groupInfo.GroupPosition = groups[parentIndex].GroupPosition;
-                    groups.Insert(parentIndex, groupInfo);
-                }
+                    if (parentIndex >= groups.Count)
+                    {
+                        groupInfo.GroupPosition = ScrollContentSize;
+                        groups.Add(groupInfo);
+                    }
+                    else
+                    {
+                        groupInfo.GroupPosition = groups[parentIndex].GroupPosition;
+                        groups.Insert(parentIndex, groupInfo);
+                    }
 
-                // Update other below group's position
-                if (parentIndex + 1 < groups.Count)
-                {
-                    for(int i = parentIndex + 1; i < groups.Count; i++)
+                    // Update other below group's position
+                    if (parentIndex + 1 < groups.Count)
                     {
-                        groups[i].GroupPosition += groupInfo.GroupSize;
-                        groups[i].StartIndex += count;
+                        for(int i = parentIndex + 1; i < groups.Count; i++)
+                        {
+                            groups[i].GroupPosition += groupInfo.GroupSize;
+                            groups[i].StartIndex += count;
+                        }
                     }
-                }
 
-                ScrollContentSize += groupInfo.GroupSize;
+                    ScrollContentSize += groupInfo.GroupSize;
+                }
+                else
+                {
+                    Tizen.Log.Error("NUI", "groupInfo is null! Check count = 0");
+                }
             }
             else
             {