From 3b028054a307f04cd3e18a35f1ae4e7599d8a74b Mon Sep 17 00:00:00 2001 From: Gargaj Date: Thu, 12 Sep 2024 16:22:36 +0200 Subject: [PATCH] fix exception when you're not logged in yet --- BlueWP.ATProto/Client.cs | 8 +++++--- BlueWP/Controls/Post/PostSelected.xaml | 2 +- BlueWP/Pages/LoginPage.xaml.cs | 11 +++++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/BlueWP.ATProto/Client.cs b/BlueWP.ATProto/Client.cs index 815556c..306ffed 100644 --- a/BlueWP.ATProto/Client.cs +++ b/BlueWP.ATProto/Client.cs @@ -115,9 +115,11 @@ protected async Task RequestAsync(string method, ILexicon input) where T : headers["Content-Type"] = rawPost.MimeType; } - headers["Authorization"] = $"Bearer {CurrentAccountSettings.Credentials.AccessToken}"; - - (input as ICustomHeaderProvider)?.SetCustomHeaders(headers, _settings.CurrentAccountSettings); + if (CurrentAccountSettings != null) + { + headers["Authorization"] = $"Bearer {CurrentAccountSettings.Credentials.AccessToken}"; + (input as ICustomHeaderProvider)?.SetCustomHeaders(headers, CurrentAccountSettings); + } var url = $"{CurrentEndpoint}/xrpc/{input.EndpointID}"; string responseJson = null; diff --git a/BlueWP/Controls/Post/PostSelected.xaml b/BlueWP/Controls/Post/PostSelected.xaml index e5f7e4e..59ebf6b 100644 --- a/BlueWP/Controls/Post/PostSelected.xaml +++ b/BlueWP/Controls/Post/PostSelected.xaml @@ -94,7 +94,7 @@ -