Skip to content

Commit

Permalink
Handle a null
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee Richardson committed Apr 15, 2024
1 parent 5453569 commit fa893f4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Eto.Gtk/Forms/Controls/GridHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -737,11 +737,12 @@ private void SetSelectionMode(bool allowEmptySelection, bool allowMultipleSelect
&& newMode is Gtk.SelectionMode.Single or Gtk.SelectionMode.Browse)
{
Control.GetCursor(out var cursorRowPath, out _);
var cursorWasSelected = Control.Selection.PathIsSelected(cursorRowPath);
var mustReselectCursor = cursorRowPath != null && Control.Selection.PathIsSelected(cursorRowPath);

Control.Selection.Mode = Gtk.SelectionMode.None;
Control.Selection.Mode = newMode;
if (cursorWasSelected)

if (mustReselectCursor)
{
Control.Selection.SelectPath(cursorRowPath);
}
Expand Down

0 comments on commit fa893f4

Please sign in to comment.