File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,7 @@ private static string CheckOldVisualStudio(RegistryKey key)
28
28
29
29
private static IEnumerable < IVisualStudioInfo > DetectOldVisualStudios ( )
30
30
{
31
- RegistryKey registryHive = RegistryKey . OpenBaseKey ( RegistryHive . LocalMachine , RegistryView . Registry32 ) ;
32
-
31
+ using ( RegistryKey registryHive = RegistryKey . OpenBaseKey ( RegistryHive . LocalMachine , RegistryView . Registry32 ) )
33
32
using ( RegistryKey key = registryHive . OpenSubKey ( @"SOFTWARE\Microsoft\VisualStudio" , false ) )
34
33
{
35
34
foreach ( string subKeyName in key . GetSubKeyNames ( ) )
@@ -40,6 +39,8 @@ private static IEnumerable<IVisualStudioInfo> DetectOldVisualStudios()
40
39
41
40
using ( RegistryKey subKey = key . OpenSubKey ( subKeyName , false ) )
42
41
{
42
+ if ( subKey == null )
43
+ continue ;
43
44
string path = CheckOldVisualStudio ( subKey ) ;
44
45
if ( path == null || ! File . Exists ( path ) )
45
46
continue ;
You can’t perform that action at this time.
0 commit comments