From a3dd21c138aeab3343351b3c9a06e64b9b6bdbdb Mon Sep 17 00:00:00 2001 From: "EverLEEst(SangHyeon Lee)" Date: Mon, 31 Oct 2022 16:36:17 +0900 Subject: [PATCH] [NUI] add null type checking after as operation. --- .../Controls/RecyclerView/CollectionView.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Tizen.NUI.Components/Controls/RecyclerView/CollectionView.cs b/src/Tizen.NUI.Components/Controls/RecyclerView/CollectionView.cs index d505f0a..6fedd70 100755 --- a/src/Tizen.NUI.Components/Controls/RecyclerView/CollectionView.cs +++ b/src/Tizen.NUI.Components/Controls/RecyclerView/CollectionView.cs @@ -1244,9 +1244,8 @@ namespace Tizen.NUI.Components colView.OnSelectionChanged(args); } - private static object CoerceSelectedItems(BindableObject bindable, object value) + private static object CoerceSelectedItems(CollectionView colView, object value) { - var colView = bindable as CollectionView; if (value == null) { return new SelectionList(colView); @@ -1260,10 +1259,8 @@ namespace Tizen.NUI.Components return new SelectionList(colView, value as IList); } - private static void SelectionModePropertyChanged(BindableObject bindable, object oldValue, object newValue) + private static void SelectionModePropertyChanged(CollectionView colView, object oldValue, object newValue) { - var colView = bindable as CollectionView; - var oldMode = (ItemSelectionMode)oldValue; var newMode = (ItemSelectionMode)newValue; @@ -1433,7 +1430,11 @@ namespace Tizen.NUI.Components if (groupHeader == null) { - groupHeader = (RecyclerViewItem)DataTemplateExtensions.CreateContent(groupHeaderTemplate, context, this); + groupHeader = DataTemplateExtensions.CreateContent(groupHeaderTemplate, context, this) as RecyclerViewItem; + if (groupHeader == null) + { + return null; + } groupHeader.Template = templ; groupHeader.isGroupHeader = true; @@ -1463,6 +1464,10 @@ namespace Tizen.NUI.Components if (groupFooter == null) { groupFooter = DataTemplateExtensions.CreateContent(groupFooterTemplate, context, this) as RecyclerViewItem; + if (groupFooter == null) + { + return null; + } groupFooter.Template = templ; groupFooter.isGroupHeader = false; -- 2.7.4