From: zhouhao02 Date: Sun, 8 Oct 2023 09:23:08 +0000 (+0800) Subject: [NUI] Fix some SVACE issues of null reference. X-Git-Tag: accepted/tizen/unified/20231205.024657~92 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bb8a3c231477c0b8b09fdc24d861c711228547c6;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Fix some SVACE issues of null reference. --- diff --git a/src/Tizen.NUI.Components/Controls/TabButton.cs b/src/Tizen.NUI.Components/Controls/TabButton.cs index 9c91b2d..e982498 100755 --- a/src/Tizen.NUI.Components/Controls/TabButton.cs +++ b/src/Tizen.NUI.Components/Controls/TabButton.cs @@ -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; } } }