[NUI] Fix SVACE issue, 4th trial (#268)
authordongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 25 May 2018 07:01:47 +0000 (16:01 +0900)
committerGitHub <noreply@github.com>
Fri, 25 May 2018 07:01:47 +0000 (16:01 +0900)
src/Tizen.NUI/src/internal/Xaml/MarkupExtensions/StaticResourceExtension.cs

index a235727..8bad461 100755 (executable)
@@ -56,27 +56,28 @@ namespace Tizen.NUI.Xaml
                        if (implicit_op != null)
                                return implicit_op.Invoke(resource, new [] { resource });
 
-                       //Special case for https://bugzilla.xamarin.com/show_bug.cgi?id=59818
-                       //On OnPlatform, check for an opImplicit from the targetType
-                       if (   Device.Flags != null
-                               && Device.Flags.Contains("xamlDoubleImplicitOpHack")
-                               && resource.GetType().GetTypeInfo().IsGenericType
-                               && (resource.GetType().GetGenericTypeDefinition() == typeof(OnPlatform<>))) {
-                               var tType = resource.GetType().GenericTypeArguments[0];
-                               var opImplicit = tType.GetImplicitConversionOperator(fromType: tType, toType: propertyType)
-                                                               ?? propertyType.GetImplicitConversionOperator(fromType: tType, toType: propertyType);
+                       if (resource != null) { 
+                               //Special case for https://bugzilla.xamarin.com/show_bug.cgi?id=59818
+                               //On OnPlatform, check for an opImplicit from the targetType
+                               if (   Device.Flags != null
+                                       && Device.Flags.Contains("xamlDoubleImplicitOpHack")
+                                       && resource.GetType().GetTypeInfo().IsGenericType
+                                       && (resource.GetType().GetGenericTypeDefinition() == typeof(OnPlatform<>))) {
+                                       var tType = resource.GetType().GenericTypeArguments[0];
+                                       var opImplicit = tType.GetImplicitConversionOperator(fromType: tType, toType: propertyType)
+                                                                       ?? propertyType.GetImplicitConversionOperator(fromType: tType, toType: propertyType);
 
-                               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 });
+                                       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 });
 
-                                       //and convert to toType
-                                       resource = opImplicit.Invoke(null, new[] { resource });
-                                       return resource;
+                                               //and convert to toType
+                                               resource = opImplicit.Invoke(null, new[] { resource });
+                                               return resource;
+                                       }
                                }
                        }
-
                        return resource;
                }