From b4e908489a83f2c6229a745163c53c58f0687a7a Mon Sep 17 00:00:00 2001 From: Eunki Hong Date: Thu, 3 Feb 2022 17:21:00 +0900 Subject: [PATCH] [NUI] Fix svace issue of RecyclerView LinearLayouter (#3924) Check if groupInfo is null. It can be null when count = 0. Signed-off-by: Eunki, Hong Co-authored-by: Eunki, Hong --- .../RecyclerView/Layouter/LinearLayouter.cs | 41 +++++++++++++--------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/LinearLayouter.cs b/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/LinearLayouter.cs index b6234a4..8ac2ff0 100755 --- a/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/LinearLayouter.cs +++ b/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/LinearLayouter.cs @@ -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 { -- 2.7.4