From: Eunki Hong Date: Fri, 4 Feb 2022 06:17:56 +0000 (+0900) Subject: [NUI] Fix svace issue of RecyclerView LinearLayouter (#3923) X-Git-Tag: accepted/tizen/unified/20231205.024657~1189 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b21dddf7ed436f956b09048ed32fc0a72877d247;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Fix svace issue of RecyclerView LinearLayouter (#3923) Check if groupInfo is null. It can be null when count = 0. Signed-off-by: Eunki, Hong Co-authored-by: Eunki, Hong --- diff --git a/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/LinearLayouter.cs b/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/LinearLayouter.cs index 6132778..e65c239 100755 --- a/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/LinearLayouter.cs +++ b/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/LinearLayouter.cs @@ -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 {