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

Commit bf46b6e

Browse files
committed
Move IVSGitExt null check to top
Don't initialize this service if IVSGitExt isn't available.
1 parent 38c65da commit bf46b6e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Microsoft.TeamFoundation.Controls;
1111
using Microsoft.VisualStudio.Shell;
1212
using Microsoft.VisualStudio.Threading;
13+
using System.Windows;
1314

1415
namespace GitHub.VisualStudio.Base
1516
{
@@ -46,11 +47,11 @@ public TeamExplorerServiceHolder(IVSGitExt gitService, JoinableTaskContext joina
4647
JoinableTaskCollection.DisplayName = nameof(TeamExplorerServiceHolder);
4748
JoinableTaskFactory = joinableTaskContext.CreateFactory(JoinableTaskCollection);
4849

49-
this.gitService = gitService;
50-
51-
UpdateActiveRepo();
50+
// This might be null in Blend or SafeMode
5251
if (gitService != null)
5352
{
53+
this.gitService = gitService;
54+
UpdateActiveRepo();
5455
gitService.ActiveRepositoriesChanged += UpdateActiveRepo;
5556
}
5657
}
@@ -151,8 +152,7 @@ void NotifyActiveRepo()
151152

152153
void UpdateActiveRepo()
153154
{
154-
// NOTE: gitService might be null in Blend or Safe Mode
155-
var repo = gitService?.ActiveRepositories.FirstOrDefault();
155+
var repo = gitService.ActiveRepositories.FirstOrDefault();
156156

157157
if (!Equals(repo, ActiveRepo))
158158
{

0 commit comments

Comments
 (0)