diff --git a/Core/Services/IMastodonService.cs b/Core/Services/IMastodonService.cs index cf3c080..c45484c 100644 --- a/Core/Services/IMastodonService.cs +++ b/Core/Services/IMastodonService.cs @@ -8,5 +8,6 @@ public interface IMastodonService Task> GetStatuses(int limit); Task> GetCustomEmojis(); + } } diff --git a/Core/Services/MastodonService.cs b/Core/Services/MastodonService.cs index 3a0a8d7..490ab21 100644 --- a/Core/Services/MastodonService.cs +++ b/Core/Services/MastodonService.cs @@ -20,6 +20,8 @@ public class MastodonService : IMastodonService private const int FeedCacheMinutes = 15; private const string EmojiCacheKey = "mastodonemojis"; + + public MastodonService(ILogger logger, AppCaches appCaches) { _logger = logger; @@ -33,6 +35,16 @@ public async Task> GetStatuses(int limit) TimeSpan.FromMinutes(FeedCacheMinutes)); return await posts!; + + if (posts != null) + { + return await posts; + } + else + { + return await Task.FromResult(new List()); + } + } @@ -61,7 +73,6 @@ private async Task> LoadStatuses(int limit) return response.Body.ToList(); - } catch (Exception ex) {