Fix some SVACE issues of null reference.
authorzhouhao02 <haozhou.zhou@samsung.com>
Sun, 8 Oct 2023 09:23:08 +0000 (17:23 +0800)
committerEunki Hong <h.pichulia@gmail.com>
Tue, 31 Oct 2023 14:07:28 +0000 (23:07 +0900)
src/Tizen.NUI.Components/Controls/TabButton.cs

index 9c91b2d..e982498 100755 (executable)
@@ -301,10 +301,10 @@ namespace Tizen.NUI.Components
                 // Text only
                 if (isEmptyIcon && !isEmptyText)
                 {
-                    if (tabButtonStyle.Size != null)
+                    if (tabButtonStyle.Size  is var size && size  != null)
                     {
-                        WidthSpecification = (int)tabButtonStyle.Size.Width;
-                        HeightSpecification = (int)tabButtonStyle.Size.Height;
+                        WidthSpecification = (int)size.Width;
+                        HeightSpecification = (int)size.Height;
                     }
 
                     if ((tabButtonStyle.Text != null) && (tabButtonStyle.Text.PixelSize != null) && (tabButtonStyle.Text.PixelSize.Normal != null))
@@ -335,11 +335,11 @@ namespace Tizen.NUI.Components
                         WidthSpecification = (int)tabButtonStyle.SizeWithIcon.Width;
                         HeightSpecification = (int)tabButtonStyle.SizeWithIcon.Height;
                     }
-
-                    if ((tabButtonStyle.Icon != null) && (tabButtonStyle.Icon.Size != null))
+                    var size = tabButtonStyle.Icon?.Size;
+                    if (size != null)
                     {
-                        Icon.WidthSpecification = (int)tabButtonStyle.Icon.Size.Width;
-                        Icon.HeightSpecification = (int)tabButtonStyle.Icon.Size.Height;
+                        Icon.WidthSpecification = (int)size.Width;
+                        Icon.HeightSpecification = (int)size.Height;
                     }
 
                     TextLabel.PixelSize = tabButtonStyle.TextSizeWithIcon;
@@ -347,10 +347,10 @@ namespace Tizen.NUI.Components
                 // Nothing
                 else
                 {
-                    if (tabButtonStyle.Size != null)
+                    if (tabButtonStyle.Size is var size && size != null)
                     {
-                        WidthSpecification = (int)tabButtonStyle.Size.Width;
-                        HeightSpecification = (int)tabButtonStyle.Size.Height;
+                        WidthSpecification = (int)size.Width;
+                        HeightSpecification = (int)size.Height;
                     }
                 }
             }