From 73d8b515b67674aeed40f2e19f3b50d0edee98c1 Mon Sep 17 00:00:00 2001 From: pichulia Date: Fri, 5 Feb 2021 20:33:35 +0900 Subject: [PATCH] [NUI] Fix wrong casting Layer and View class don't have any depencency. So if we try to convert Layer to View (without "as" operator), it may create some critical issues. Signed-off-by: pichulia --- src/Tizen.NUI/src/public/Layouting/LayoutItem.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Tizen.NUI/src/public/Layouting/LayoutItem.cs b/src/Tizen.NUI/src/public/Layouting/LayoutItem.cs index cddda5e..0d60b2b 100755 --- a/src/Tizen.NUI/src/public/Layouting/LayoutItem.cs +++ b/src/Tizen.NUI/src/public/Layouting/LayoutItem.cs @@ -168,7 +168,10 @@ namespace Tizen.NUI OnAttachedToOwner(); // Add layout to parent layout if a layout container View parent = Owner.GetParent() as View; - (parent?.Layout as LayoutGroup)?.Add( this ); + if (parent != null) + { + (parent?.Layout as LayoutGroup)?.Add( this ); + } // If Add or ChangeOnAdd then do not update condition if (ConditionForAnimation.Equals(TransitionCondition.Unspecified)) @@ -551,8 +554,7 @@ namespace Tizen.NUI " top:" + _layoutPositionData.Top + " right:" + _layoutPositionData.Right + " bottom:" + _layoutPositionData.Bottom ); - Container onwerContainer = Owner.GetParent(); - View onwerView = onwerContainer is Layer ? new View(Layer.getCPtr(onwerContainer).Handle, false) : onwerContainer as View; + View onwerView = Owner.GetParent() as View; if (onwerView != null && onwerView.Layout != null && onwerView.Layout.LayoutWithTransition) { -- 2.7.4