[Sys.Data] Fix Novell Bug #519648
[mono.git] / mcs / class / System.Data / System.Data.Common / DataContainer.cs
index 29e7b11efc1e3f05e274a1dbc8136a0681672a67..7a46a04e229bf032d80c816b3db05028a94a5b05 100644 (file)
@@ -23,7 +23,9 @@
 using System;
 using System.Collections;
 using System.Reflection;
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
+#endif
 
 namespace System.Data.Common
 {
@@ -52,7 +54,13 @@ namespace System.Data.Common
                        get { return IsNull (index) ? DBNull.Value : GetValue (index); }
                        set {
                                if (value == null) {
-                                       CopyValue (Column.Table.DefaultValuesRowIndex, index);
+                                       // Table might not have a default values row to copy from
+                                       if (Column.Table.DefaultValuesRowIndex == -1) {
+                                               ZeroOut (index);
+                                               null_values [index] = true;
+                                       } else {
+                                               CopyValue (Column.Table.DefaultValuesRowIndex, index);
+                                       }
                                        return;
                                }