11using Microsoft . TeamFoundation . Git . Controls . Extensibility ;
22using System ;
33using System . ComponentModel . Composition ;
4- using System . Diagnostics ;
54using System . Globalization ;
65using System . Linq ;
76using GitHub . Extensions ;
@@ -116,7 +115,7 @@ static IEnumerable<ISimpleRepositoryModel> PokeTheRegistryForRepositoryList()
116115 {
117116 using ( var subkey = key . OpenSubKey ( x ) )
118117 {
119- var path = subkey . GetValue ( "Path" ) as string ;
118+ var path = subkey ? . GetValue ( "Path" ) as string ;
120119 if ( path != null )
121120 {
122121 var uri = VisualStudio . Services . GetRepoFromPath ( path ) ? . GetUri ( ) ;
@@ -136,8 +135,7 @@ static string PokeTheRegistryForLocalClonePath()
136135 {
137136 using ( var key = OpenGitKey ( "General" ) )
138137 {
139- if ( key == null ) return null ;
140- return ( string ) key . GetValue ( "DefaultRepositoryPath" , string . Empty , RegistryValueOptions . DoNotExpandEnvironmentNames ) ;
138+ return ( string ) key ? . GetValue ( "DefaultRepositoryPath" , string . Empty , RegistryValueOptions . DoNotExpandEnvironmentNames ) ;
141139 }
142140 }
143141
@@ -147,8 +145,8 @@ public string SetDefaultProjectPath(string path)
147145 string old ;
148146 using ( var key = Registry . CurrentUser . OpenSubKey ( PathsKey , true ) )
149147 {
150- old = ( string ) key . GetValue ( "Value0" , string . Empty , RegistryValueOptions . DoNotExpandEnvironmentNames ) ;
151- key . SetValue ( "Value0" , path , RegistryValueKind . String ) ;
148+ old = ( string ) key ? . GetValue ( "Value0" , string . Empty , RegistryValueOptions . DoNotExpandEnvironmentNames ) ;
149+ key ? . SetValue ( "Value0" , path , RegistryValueKind . String ) ;
152150 }
153151 return old ;
154152 }
0 commit comments