fix Nullable conversion in JAVAEE environment
authorRoei Erez <roeie@mono-cvs.ximian.com>
Tue, 13 May 2008 13:49:36 +0000 (13:49 -0000)
committerRoei Erez <roeie@mono-cvs.ximian.com>
Tue, 13 May 2008 13:49:36 +0000 (13:49 -0000)
svn path=/trunk/mcs/; revision=103077

mcs/class/System.Core/System.Linq.jvm/Math.cs

index 41952d5aa8b109322ae491d6907b9c13303dad3f..8e5f6ce5f32872eca48f5cd29f78ee690dcdd28c 100644 (file)
@@ -223,8 +223,8 @@ namespace System.Linq.jvm
         }\r
 \r
         public static object ConvertToTypeChecked(object a, Type fromType, Type toType)\r
-        {   \r
-                       if (a == null && !toType.IsValueType)\r
+        {\r
+                       if (a == null && Expression.IsNullable (toType) || !toType.IsValueType)\r
                                return a;\r
                        \r
             if (IsType(toType, a)){\r
@@ -240,8 +240,8 @@ namespace System.Linq.jvm
 \r
                public static object ConvertToTypeUnchecked (object a, Type fromType, Type toType)\r
                {\r
-                       if (a == null && !toType.IsValueType)\r
-                               return a;\r
+                       if (a == null && Expression.IsNullable (toType) || !toType.IsValueType)                                                 \r
+                                       return a;\r
                                                                \r
                        if (IsType (toType, a)) {\r
                                return a;\r