2008-12-08 Ivan N. Zlatev <contact@i-nz.net>
authorIvan Zlatev <ivan@ivanz.com>
Mon, 8 Dec 2008 18:06:58 +0000 (18:06 -0000)
committerIvan Zlatev <ivan@ivanz.com>
Mon, 8 Dec 2008 18:06:58 +0000 (18:06 -0000)
* DataGridViewRow.cs: Prevent an exception on a not yet databound grid,
where datasource is null.
[Fixes exception reported in bug 441240]

svn path=/trunk/mcs/; revision=121016

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRow.cs

index 026236f86beddc6de73f816b5450b2fbe2a6179b..eefb2ed752319903f681367fe30a6ef8407e2dd4 100644 (file)
@@ -1,3 +1,9 @@
+2008-12-08  Ivan N. Zlatev  <contact@i-nz.net>
+
+       * DataGridViewRow.cs: Prevent an exception on a not yet databound grid, 
+       where datasource is null.
+       [Fixes exception reported in bug 441240]
+
 2008-12-08  Ivan N. Zlatev  <contact@i-nz.net>
 
        * DataGridView.cs: EndEdit validation fixes.
index ff2c2e9858b576d7f91e61e6fa390aea11ea7276..11fb0a79267005e23e865633cab8dd79f3c5ec20 100644 (file)
@@ -91,7 +91,7 @@ namespace System.Windows.Forms
                [EditorBrowsable (EditorBrowsableState.Advanced)]
                public object DataBoundItem {
                        get {
-                               if (base.DataGridView != null) {
+                               if (base.DataGridView != null && DataGridView.DataSource != null) {
                                        CurrencyManager data = DataGridView.BindingContext[DataGridView.DataSource] as CurrencyManager;
                                        if (data != null && data.List.Count > base.Index) {
                                                return data.List[base.Index];