Skip to content
This repository was archived by the owner on May 19, 2021. It is now read-only.

Commit 07b522b

Browse files
author
Ville Tuhkanen
committed
Fix exception thrown when run from command line
Opening project from command line doesn't work because exception is thrown when trying to launch the application. Exception occurs because application is trying to retrieve _launchArguments for the row of the currently selected cell. When running from command line currently selected cell is null and that causes a null reference exception to occur. Issue is fixed by checking the current grid and cell for null and handling the situation like no row has been selected.
1 parent 3caec9d commit 07b522b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

UnityLauncher/Form1.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,10 +1128,10 @@ private void UnityVersionsListDownloaded(object sender, DownloadStringCompletedE
11281128
string GetSelectedRowData(string key)
11291129
{
11301130
string path = null;
1131-
var selected = gridRecent.CurrentCell.RowIndex;
1132-
if (selected > -1)
1131+
var selected = gridRecent?.CurrentCell?.RowIndex;
1132+
if (selected.HasValue && selected > -1)
11331133
{
1134-
path = gridRecent.Rows[selected].Cells[key].Value?.ToString();
1134+
path = gridRecent.Rows[selected.Value].Cells[key].Value?.ToString();
11351135
}
11361136
return path;
11371137
}

0 commit comments

Comments
 (0)