[NUI] Fix svace issue (#41)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Wed, 17 Jan 2018 11:35:32 +0000 (20:35 +0900)
committerGitHub <noreply@github.com>
Wed, 17 Jan 2018 11:35:32 +0000 (20:35 +0900)
* [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 <huiyu.eun@samsung.com>
* [NUI] Modify unassigned local variable 'str'

Signed-off-by: huiyu,eun <huiyu.eun@samsung.com>
src/Tizen.NUI/src/internal/WidgetApplication.cs
src/Tizen.NUI/src/public/UIComponents/Button.cs

index 185d6bd..02022dd 100755 (executable)
@@ -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();
+                    }
                 }
             }
 
index 8c59293..5e668f3 100755 (executable)
@@ -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
+}