This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed
src/UnityExtension/Assets/Editor/GitHub.Unity/UI Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -34,9 +34,16 @@ private AuthenticationService AuthenticationService
3434 {
3535 if ( authenticationService == null )
3636 {
37- var host = Repository != null
38- ? new UriString ( Repository . CloneUrl . ToRepositoryUri ( ) . GetComponents ( UriComponents . SchemeAndServer , UriFormat . SafeUnescaped ) )
39- : UriString . ToUriString ( HostAddress . GitHubDotComHostAddress . WebUri ) ;
37+ UriString host ;
38+ if ( Repository != null && Repository . CloneUrl != null && Repository . CloneUrl . IsValidUri )
39+ {
40+ host = new UriString ( Repository . CloneUrl . ToRepositoryUri ( )
41+ . GetComponents ( UriComponents . SchemeAndServer , UriFormat . SafeUnescaped ) ) ;
42+ }
43+ else
44+ {
45+ host = UriString . ToUriString ( HostAddress . GitHubDotComHostAddress . WebUri ) ;
46+ }
4047
4148 AuthenticationService = new AuthenticationService ( host , new AppConfiguration ( ) , Platform . Keychain ) ;
4249 }
Original file line number Diff line number Diff line change @@ -223,9 +223,16 @@ private void GoToProfile(object obj)
223223 }
224224 private void SignOut ( object obj )
225225 {
226- var host = Repository != null
227- ? new UriString ( Repository . CloneUrl . ToRepositoryUri ( ) . GetComponents ( UriComponents . SchemeAndServer , UriFormat . SafeUnescaped ) )
228- : UriString . ToUriString ( HostAddress . GitHubDotComHostAddress . WebUri ) ;
226+ UriString host ;
227+ if ( Repository != null && Repository . CloneUrl != null && Repository . CloneUrl . IsValidUri )
228+ {
229+ host = new UriString ( Repository . CloneUrl . ToRepositoryUri ( )
230+ . GetComponents ( UriComponents . SchemeAndServer , UriFormat . SafeUnescaped ) ) ;
231+ }
232+ else
233+ {
234+ host = UriString . ToUriString ( HostAddress . GitHubDotComHostAddress . WebUri ) ;
235+ }
229236
230237 var apiClient = ApiClient . Create ( host , Platform . Keychain , new AppConfiguration ( ) ) ;
231238 apiClient . Logout ( host ) ;
You can’t perform that action at this time.
0 commit comments