Skip to content

Commit

Permalink
Add null check (#1874)
Browse files Browse the repository at this point in the history
  • Loading branch information
neilenns authored Dec 15, 2024
1 parent fa27040 commit f431823
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion UI/Panels/InputConfigPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ private void dataGridViewConfig_KeyUp(object sender, KeyEventArgs e)
{

// handle clicks on header cells or row-header cells
if (dgv.CurrentRow.Index < 0 || dgv.CurrentCell.ColumnIndex < 0) return;
// Issue 1863: Check for null (nothing in the grid) so there's no crash
if (dgv.CurrentRow == null || dgv.CurrentRow.Index < 0 || dgv.CurrentCell.ColumnIndex < 0) return;

dgv.CurrentCell = dgv[cellIndex, dgv.CurrentRow.Index];

Expand Down
3 changes: 2 additions & 1 deletion UI/Panels/OutputConfigPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ private void DataGridViewConfig_KeyUp(object sender, KeyEventArgs e)
{

// handle clicks on header cells or row-header cells
if (dgv.CurrentRow.Index < 0 || dgv.CurrentCell.ColumnIndex < 0) return;
// Issue 1863: Check for null (nothing in the grid) so there's no crash
if (dgv.CurrentRow == null || dgv.CurrentRow.Index < 0 || dgv.CurrentCell.ColumnIndex < 0) return;

dgv.CurrentCell = dgv[cellIndex, dgv.CurrentRow.Index];

Expand Down

0 comments on commit f431823

Please sign in to comment.