From 0c1e2fb2bf4abd30680158aa2813b91f365b6f2a Mon Sep 17 00:00:00 2001 From: huiyueun <35286162+huiyueun@users.noreply.github.com> Date: Wed, 17 Jan 2018 20:35:32 +0900 Subject: [PATCH] [NUI] Fix svace issue (#41) * [NUI] Fix svace issue Value widget, which was created by as-operator, so can be null, is dereferenced in method call widget.GetIntPtr() Value value, which is result of method invocation with possible null return value, is dereferenced in method call value.Get() Signed-off-by: huiyu,eun * [NUI] Modify unassigned local variable 'str' Signed-off-by: huiyu,eun --- src/Tizen.NUI/src/internal/WidgetApplication.cs | 5 ++++- src/Tizen.NUI/src/public/UIComponents/Button.cs | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Tizen.NUI/src/internal/WidgetApplication.cs b/src/Tizen.NUI/src/internal/WidgetApplication.cs index 185d6bd..02022dd 100755 --- a/src/Tizen.NUI/src/internal/WidgetApplication.cs +++ b/src/Tizen.NUI/src/internal/WidgetApplication.cs @@ -147,7 +147,10 @@ namespace Tizen.NUI if (widgetInfo[widgetType] == widgetName) { Widget widget = Activator.CreateInstance(widgetType) as Widget; - return widget.GetIntPtr(); + if (widget) + { + return widget.GetIntPtr(); + } } } diff --git a/src/Tizen.NUI/src/public/UIComponents/Button.cs b/src/Tizen.NUI/src/public/UIComponents/Button.cs index 8c59293..5e668f3 100755 --- a/src/Tizen.NUI/src/public/UIComponents/Button.cs +++ b/src/Tizen.NUI/src/public/UIComponents/Button.cs @@ -757,8 +757,8 @@ namespace Tizen.NUI.UIComponents Tizen.NUI.PropertyMap map = new Tizen.NUI.PropertyMap(); GetProperty( Button.Property.LABEL).Get(map); Tizen.NUI.PropertyValue value = map.Find( TextVisualProperty.Text, "Text"); - string str; - value.Get(out str); + string str = ""; + value?.Get(out str); return str; } set @@ -793,4 +793,4 @@ namespace Tizen.NUI.UIComponents } -} \ No newline at end of file +} -- 2.7.4