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

Commit 59bb542

Browse files
committed
Move exception handling inside the method
1 parent dc96ded commit 59bb542

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/GitHub.VisualStudio/Base/TeamExplorerNavigationItemBase.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,7 @@ public TeamExplorerNavigationItemBase(ISimpleApiClientFactory apiFactory, ITeamE
2525
IsVisible = false;
2626
IsEnabled = true;
2727

28-
try
29-
{
30-
OnThemeChanged();
31-
}
32-
catch (ArgumentNullException)
33-
{
34-
// This throws in the unit test runner.
35-
}
28+
OnThemeChanged();
3629
VSColorTheme.ThemeChanged += _ =>
3730
{
3831
OnThemeChanged();
@@ -49,11 +42,18 @@ public override async void Invalidate()
4942

5043
void OnThemeChanged()
5144
{
52-
var color = VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowTextColorKey);
53-
var brightness = color.GetBrightness();
54-
var dark = brightness > 0.5f;
45+
try
46+
{
47+
var color = VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowTextColorKey);
48+
var brightness = color.GetBrightness();
49+
var dark = brightness > 0.5f;
5550

56-
Icon = SharedResources.GetDrawingForIcon(octicon, dark ? Colors.DarkThemeNavigationItem : Colors.LightThemeNavigationItem, dark ? "dark" : "light");
51+
Icon = SharedResources.GetDrawingForIcon(octicon, dark ? Colors.DarkThemeNavigationItem : Colors.LightThemeNavigationItem, dark ? "dark" : "light");
52+
}
53+
catch (ArgumentNullException)
54+
{
55+
// This throws in the unit test runner.
56+
}
5757
}
5858

5959
void UpdateRepo(IGitRepositoryInfo repo)

0 commit comments

Comments
 (0)