[NUI] fix SVACE issues 2nd trial (#263)
authordongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 23 May 2018 06:58:46 +0000 (15:58 +0900)
committerGitHub <noreply@github.com>
Wed, 23 May 2018 06:58:46 +0000 (15:58 +0900)
src/Tizen.NUI/src/internal/Xaml/CreateValuesVisitor.cs
src/Tizen.NUI/src/internal/Xaml/MarkupExtensionParser.cs
src/Tizen.NUI/src/internal/Xaml/MarkupExtensions/StaticResourceExtension.cs
src/Tizen.NUI/src/internal/XamlBinding/Interactivity/EventTrigger.cs
src/Tizen.NUI/src/internal/XamlBinding/ObservableWrapper.cs
src/Tizen.NUI/src/public/CustomViewRegistry.cs
src/Tizen.NUI/src/public/XamlBinding/Element.cs

index 4db5ce2..70ef16b 100755 (executable)
@@ -66,7 +66,7 @@ namespace Tizen.NUI.Xaml
                        else if (!type.GetTypeInfo().DeclaredConstructors.Any(ci => ci.IsPublic && ci.GetParameters().Length == 0) &&
                                 !ValidateCtorArguments(type, node, out ctorargname))
                        {
-                               throw new XamlParseException($"The Property {ctorargname} is required to create a {type.FullName} object.", node);
+                               throw new XamlParseException($"The Property {ctorargname} is required to create a {type?.FullName} object.", node);
                        }
                        else
                        {
index 16ad97d..46f4c53 100755 (executable)
@@ -75,7 +75,7 @@ namespace Tizen.NUI.Xaml
                                        (Func<TypeConverter>)null, serviceProvider);
                        }
 
-                       setter.Invoke(markupExtension, new[] { value });
+                       setter?.Invoke(markupExtension, new[] { value });
                }
        }
 }
\ No newline at end of file
index 089395d..39d7e55 100755 (executable)
@@ -69,7 +69,7 @@ namespace Tizen.NUI.Xaml
                                if (opImplicit != null) {
                                        //convert the OnPlatform<T> to T
                                        var opPlatformImplicitConversionOperator = resource.GetType().GetImplicitConversionOperator(fromType: resource.GetType(), toType: tType);
-                                       resource = opPlatformImplicitConversionOperator.Invoke(null, new[] { resource });
+                                       resource = opPlatformImplicitConversionOperator?.Invoke(null, new[] { resource });
 
                                        //and convert to toType
                                        resource = opImplicit.Invoke(null, new[] { resource });
index 0363f6a..1a9cd29 100755 (executable)
@@ -65,7 +65,7 @@ namespace Tizen.NUI.Binding
                        try
                        {
                                _eventinfo = bindable.GetType().GetRuntimeEvent(Event);
-                               _handlerdelegate = s_handlerinfo.CreateDelegate(_eventinfo.EventHandlerType, this);
+                               _handlerdelegate = s_handlerinfo.CreateDelegate(_eventinfo?.EventHandlerType, this);
                        }
                        catch (Exception)
                        {
index f2abf9a..41d9742 100755 (executable)
@@ -180,7 +180,7 @@ namespace Tizen.NUI.Binding
                                        handler(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Move, e.NewItems, outerNewIndex, outerOldIndex));
                                        break;
                                case NotifyCollectionChangedAction.Remove:
-                                       if (e.OldStartingIndex == -1 || e.OldItems.Count > 1)
+                                       if (e.OldStartingIndex == -1 || e.OldItems?.Count > 1)
                                                goto case NotifyCollectionChangedAction.Reset;
 
                                        var removedItem = e.OldItems[0] as TRestrict;
@@ -192,11 +192,11 @@ namespace Tizen.NUI.Binding
                                        handler(this, args);
                                        break;
                                case NotifyCollectionChangedAction.Replace:
-                                       if (e.NewStartingIndex == -1 || e.OldStartingIndex == -1 || e.NewItems.Count > 1)
+                                       if (e.NewStartingIndex == -1 || e.OldStartingIndex == -1 || e.NewItems?.Count > 1)
                                                goto case NotifyCollectionChangedAction.Reset;
 
                                        var newReplaceItem = e.NewItems[0] as TRestrict;
-                                       var oldReplaceItem = e.OldItems[0] as TRestrict;
+                                       var oldReplaceItem = e.OldItems?[0] as TRestrict;
 
                                        if ((newReplaceItem == null || !newReplaceItem.Owned) && (oldReplaceItem == null || !oldReplaceItem.Owned))
                                        {
index 812c1c5..58292f7 100755 (executable)
@@ -229,7 +229,14 @@ namespace Tizen.NUI
             {
                 // Create the control
                 CustomView newControl = controlConstructor();
-                return newControl.GetPtrfromView();  // return pointer to handle
+                if (newControl != null)
+                {
+                    return newControl.GetPtrfromView();  // return pointer to handle
+                }
+                else
+                {
+                    return IntPtr.Zero;
+                }
             }
             else
             {
@@ -461,23 +468,23 @@ namespace Tizen.NUI
                 {
                     PropertyMap map = new PropertyMap();
                     ok = propValue.Get(map);
-                    if( ok )
+                    if (ok)
                     {
-                        propertyInfo.SetValue( view, map );
+                        propertyInfo.SetValue(view, map);
                     }
                 }
                 else if (type.Equals(typeof(PropertyArray)))
                 {
                     PropertyArray array = new PropertyArray();
                     ok = propValue.Get(array);
-                    if( ok )
+                    if (ok)
                     {
-                        propertyInfo.SetValue( view, array );
+                        propertyInfo.SetValue(view, array);
                     }
                 }
                 else
                 {
-                    throw new global::System.InvalidOperationException("SetPropertyValue Unimplemented type for Property Value for " + type.FullName );
+                    throw new global::System.InvalidOperationException("SetPropertyValue Unimplemented type for Property Value for " + type.FullName);
                 }
                 if (!ok)
                 {
index 4f2f9d0..e1e2f95 100755 (executable)
@@ -233,7 +233,7 @@ namespace Tizen.NUI.Binding
                                RealParent = value;
                                if (RealParent != null)
                                {
-                                       OnParentResourcesChanged(RealParent.GetMergedResources());
+                                       OnParentResourcesChanged(RealParent?.GetMergedResources());
                                        ((IElement)RealParent).AddResourcesChangedListener(OnParentResourcesChanged);
                                }