[NUI] Fix svace NULL dereference issues
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Fri, 16 Sep 2022 06:34:51 +0000 (15:34 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 21 Sep 2022 05:52:33 +0000 (14:52 +0900)
NULL dereference codes have been fixed.

src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs
src/Tizen.NUI/src/public/Window/BorderWindow.cs

index 7f84339..58caae3 100755 (executable)
@@ -676,7 +676,7 @@ namespace Tizen.NUI.BaseComponents
                     }
                 }
                 contentMap.Dispose();
-                val.Dispose();
+                val?.Dispose();
             }
             NUILog.Debug($">");
 
@@ -1051,8 +1051,8 @@ namespace Tizen.NUI.BaseComponents
             {
                 if (current.TryGetTarget(out currentView))
                 {
-                    if (currentView.InternalSavedDynamicPropertyCallbacks.TryGetValue(id, out currentCallback) && currentView != null
-                        && currentView.InternalSavedDynamicPropertyCallbacks != null)
+                    if (currentView.InternalSavedDynamicPropertyCallbacks != null &&
+                        currentView.InternalSavedDynamicPropertyCallbacks.TryGetValue(id, out currentCallback) && currentView != null)
                     {
                         ret = currentCallback?.Invoke(returnType, frameNumber);
                     }
@@ -1079,7 +1079,7 @@ namespace Tizen.NUI.BaseComponents
                 case (int)(VectorProperty.FillColor):
                 case (int)(VectorProperty.StrokeColor):
                     Vector3 tmpVector3 = new Vector3(-1, -1, -1);
-                    if (ret.Get(tmpVector3))
+                    if ((ret != null) && ret.Get(tmpVector3))
                     {
                         val1 = tmpVector3.X;
                         val2 = tmpVector3.Y;
@@ -1092,7 +1092,7 @@ namespace Tizen.NUI.BaseComponents
                 case (int)(VectorProperty.TransformPosition):
                 case (int)(VectorProperty.TransformScale):
                     Vector2 tmpVector2 = new Vector2(-1, -1);
-                    if (ret.Get(tmpVector2))
+                    if ((ret != null) && ret.Get(tmpVector2))
                     {
                         val1 = tmpVector2.X;
                         val2 = tmpVector2.Y;
@@ -1106,7 +1106,7 @@ namespace Tizen.NUI.BaseComponents
                 case (int)(VectorProperty.TransformRotation):
                 case (int)(VectorProperty.TransformOpacity):
                     float tmpFloat = -1;
-                    if (ret.Get(out tmpFloat))
+                    if ((ret != null) && ret.Get(out tmpFloat))
                     {
                         val1 = tmpFloat;
                     }
@@ -1115,7 +1115,7 @@ namespace Tizen.NUI.BaseComponents
                     //do nothing
                     break;
             }
-            ret.Dispose();
+            ret?.Dispose();
         }
         #endregion Internal
 
index 93d0bd6..3e42ca1 100755 (executable)
@@ -149,13 +149,13 @@ namespace Tizen.NUI
 
                 if (minSize != borderInterface.MinSize)
                 {
-                    using Size2D mimimumSize = new Size2D(borderInterface.MinSize.Width, borderInterface.MinSize.Height + (int)borderHeight);
+                    using Size2D mimimumSize = new Size2D((borderInterface.MinSize?.Width ?? 0), (borderInterface.MinSize?.Height ?? 0) + (int)borderHeight);
                     SetMimimumSize(mimimumSize);
                     minSize = borderInterface.MinSize;
                 }
                 if (maxSize != borderInterface.MaxSize)
                 {
-                    using Size2D maximumSize = new Size2D(borderInterface.MaxSize.Width, borderInterface.MaxSize.Height + (int)borderHeight);
+                    using Size2D maximumSize = new Size2D((borderInterface.MaxSize?.Width ?? 0), (borderInterface.MaxSize?.Height ?? 0) + (int)borderHeight);
                     SetMaximumSize(maximumSize);
                     maxSize = borderInterface.MaxSize;
                 }