Skip to content

Commit 5e9113a

Browse files
authored
Fix: Fixed crash when unable to connect to GitHub (#14246)
1 parent 49d912d commit 5e9113a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/Files.App/Utils/Git/GitHelpers.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,18 @@ public static async Task RequireGitAuthenticationAsync()
545545
client.DefaultRequestHeaders.Add("Accept", "application/json");
546546
client.DefaultRequestHeaders.Add("User-Agent", "Files App");
547547

548-
var codeResponse = await client.PostAsync(
549-
$"https://github.com/login/device/code?client_id={_clientId}&scope=repo",
550-
new StringContent(""));
548+
HttpResponseMessage codeResponse;
549+
try
550+
{
551+
codeResponse = await client.PostAsync(
552+
$"https://github.com/login/device/code?client_id={_clientId}&scope=repo",
553+
new StringContent(""));
554+
}
555+
catch
556+
{
557+
await DynamicDialogFactory.GetFor_GitHubConnectionError().TryShowAsync();
558+
return;
559+
}
551560

552561
if (!codeResponse.IsSuccessStatusCode)
553562
{

0 commit comments

Comments
 (0)