+2009-01-27 Ivan N. Zlatev <contact@i-nz.net>
+
+ * DataGridView.cs: Fix a NRE when setting the CurrentCell to null.
+
2009-01-27 Ivan N. Zlatev <contact@i-nz.net>
* XplatUIX11.cs: Fire Timer.Tick even if there is no MainForm for the
/// to the data cache, or the new cell is in a hidden
/// row.
/////////////////////////////////////////////////////
- if (value.DataGridView != this)
+ if (value == null)
+ MoveCurrentCell (-1, -1, true, false, false, true);
+ else if (value.DataGridView != this)
throw new ArgumentException("The cell is not in this DataGridView.");
-
- if (value != null)
- MoveCurrentCell (value.OwningColumn.Index, value.OwningRow.Index, true, false, false, true);
else
- MoveCurrentCell (-1, -1, true, false, false, true);
+ MoveCurrentCell (value.OwningColumn.Index, value.OwningRow.Index, true, false, false, true);
}
}