[NUI] Fix svace issue of RecyclerView LinearLayouter (#3923)
authorEunki Hong <h.pichulia@gmail.com>
Fri, 4 Feb 2022 06:17:56 +0000 (15:17 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 8 Feb 2022 04:41:28 +0000 (13:41 +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 6132778..e65c239 100755 (executable)
@@ -801,28 +801,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
             {