@@ -32,28 +32,29 @@ public UpgradeWindow(string currentVersion, string projectPath, string commandLi
32
32
btnDownload . IsEnabled = true ;
33
33
34
34
// if dont have exact version, show red outline
35
- if ( MainWindow . unityInstalledVersions . ContainsKey ( currentVersion ) == false )
35
+ if ( currentVersion == null || MainWindow . unityInstalledVersions . ContainsKey ( currentVersion ) == false )
36
36
{
37
37
txtCurrentVersion . BorderBrush = Brushes . Red ;
38
38
txtCurrentVersion . BorderThickness = new Thickness ( 1 ) ;
39
39
}
40
-
41
- // remove china c1 from version
42
- if ( currentVersion . Contains ( 'c' ) ) currentVersion = currentVersion . Replace ( "c1" , "" ) ;
43
-
44
- // find nearest version
45
- string nearestVersion = Tools . FindNearestVersion ( currentVersion , MainWindow . unityInstalledVersions . Keys . ToList ( ) ) ;
46
-
47
- if ( nearestVersion != null )
40
+ else // not null
48
41
{
49
- // select nearest version
50
- for ( int i = 0 ; i < MainWindow . unityInstallationsSource . Count ; i ++ )
42
+ // remove china c1 from version
43
+ if ( currentVersion . Contains ( 'c' ) ) currentVersion = currentVersion . Replace ( "c1" , "" ) ;
44
+ // find nearest version
45
+ string nearestVersion = Tools . FindNearestVersion ( currentVersion , MainWindow . unityInstalledVersions . Keys . ToList ( ) ) ;
46
+
47
+ if ( nearestVersion != null )
51
48
{
52
- if ( MainWindow . unityInstallationsSource [ i ] . Version == nearestVersion )
49
+ // select nearest version
50
+ for ( int i = 0 ; i < MainWindow . unityInstallationsSource . Count ; i ++ )
53
51
{
54
- gridAvailableVersions . SelectedIndex = i ;
55
- gridAvailableVersions . ScrollIntoView ( gridAvailableVersions . SelectedItem ) ;
56
- break ;
52
+ if ( MainWindow . unityInstallationsSource [ i ] . Version == nearestVersion )
53
+ {
54
+ gridAvailableVersions . SelectedIndex = i ;
55
+ gridAvailableVersions . ScrollIntoView ( gridAvailableVersions . SelectedItem ) ;
56
+ break ;
57
+ }
57
58
}
58
59
}
59
60
}
@@ -77,7 +78,7 @@ private void BtnOpenReleasePage_Click(object sender, RoutedEventArgs e)
77
78
Tools . OpenReleaseNotes ( txtCurrentVersion . Text ) ;
78
79
}
79
80
80
-
81
+
81
82
private void BtnDownloadEditor_Click ( object sender , RoutedEventArgs e )
82
83
{
83
84
Tools . DownloadInBrowser ( txtCurrentVersion . Text ) ;
0 commit comments