This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +29
-15
lines changed
src/GitHub.TeamFoundation.14 Expand file tree Collapse file tree 1 file changed +29
-15
lines changed Original file line number Diff line number Diff line change @@ -21,28 +21,42 @@ static RegistryKey OpenGitKey(string path)
2121
2222 internal static IEnumerable < ILocalRepositoryModel > PokeTheRegistryForRepositoryList ( )
2323 {
24- using ( var key = OpenGitKey ( "Repositories" ) )
24+ var key = OpenGitKey ( "Repositories" ) ;
25+
26+ if ( key != null )
2527 {
26- return key . GetSubKeyNames ( ) . Select ( x =>
28+ using ( key )
2729 {
28- using ( var subkey = key . OpenSubKey ( x ) )
30+ return key . GetSubKeyNames ( ) . Select ( x =>
2931 {
30- try
31- {
32- var path = subkey ? . GetValue ( "Path" ) as string ;
33- if ( path != null && Directory . Exists ( path ) )
34- return new LocalRepositoryModel ( path ) ;
35- }
36- catch ( Exception )
32+ var subkey = key . OpenSubKey ( x ) ;
33+
34+ if ( subkey != null )
3735 {
38- // no sense spamming the log, the registry might have ton of stale things we don't care about
36+ using ( subkey )
37+ {
38+ try
39+ {
40+ var path = subkey ? . GetValue ( "Path" ) as string ;
41+ if ( path != null && Directory . Exists ( path ) )
42+ return new LocalRepositoryModel ( path ) ;
43+ }
44+ catch ( Exception )
45+ {
46+ // no sense spamming the log, the registry might have ton of stale things we don't care about
47+ }
48+
49+ }
3950 }
51+
4052 return null ;
41- }
42- } )
43- . Where ( x => x != null )
44- . ToList ( ) ;
53+ } )
54+ . Where ( x => x != null )
55+ . ToList ( ) ;
56+ }
4557 }
58+
59+ return new ILocalRepositoryModel [ 0 ] ;
4660 }
4761
4862 internal static string PokeTheRegistryForLocalClonePath ( )
You can’t perform that action at this time.
0 commit comments