Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit d6e8c22

Browse files
authored
Merge pull request #1649 from github/fixes/1620-safemode-and-blend
Fix extension when running in SafeMode / Expression Blend
2 parents a3aca21 + 3d2d2ef commit d6e8c22

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/GitHub.TeamFoundation.14/Base/TeamExplorerServiceHolder.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ public TeamExplorerServiceHolder(IVSGitExt gitService)
3535
syncContext = SynchronizationContext.Current;
3636

3737
UpdateActiveRepo();
38-
gitService.ActiveRepositoriesChanged += UpdateActiveRepo;
38+
if (gitService != null)
39+
{
40+
gitService.ActiveRepositoriesChanged += UpdateActiveRepo;
41+
}
3942
}
4043

4144

@@ -135,7 +138,9 @@ void NotifyActiveRepo()
135138

136139
void UpdateActiveRepo()
137140
{
138-
var repo = gitService.ActiveRepositories.FirstOrDefault();
141+
// NOTE: gitService will be null in Expression Blend or Safe Mode
142+
var repo = gitService?.ActiveRepositories.FirstOrDefault();
143+
139144
if (!Equals(repo, ActiveRepo))
140145
// so annoying that this is on the wrong thread
141146
syncContext.Post(r => ActiveRepo = r as ILocalRepositoryModel, repo);

0 commit comments

Comments
 (0)