Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
Null MUCs reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
COM8 committed Jun 5, 2021
1 parent 68dfbbf commit d3a8e09
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Manager/Classes/Chat/DataCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Logging;
using Microsoft.EntityFrameworkCore;
using Shared.Classes;
using Shared.Classes.AppCenter;
using Shared.Classes.Threading;
using Storage.Classes.Contexts;
using Storage.Classes.Models.Account;
Expand Down Expand Up @@ -146,6 +147,14 @@ public IEnumerable<MucInfoModel> GetMucs(string accountBareJid)
CHATS_SEMA.Wait();
IEnumerable<MucInfoModel> mucs = CHATS.Where(c => c.Chat.chatType == ChatType.MUC && string.Equals(c.Chat.accountBareJid, accountBareJid)).Select(c => c.Chat.muc).ToList();
CHATS_SEMA.Release();

int countNull = mucs.Where(m => m is null).Count();
if (countNull > 0)
{
Dictionary<string, string> payload = new Dictionary<string, string> { { "Count_NULL", countNull.ToString() } };
AppCenterCrashHelper.INSTANCE.TrackError(new ArgumentNullException(), "DataCache.INSTANCE.GetMucs() has MUCs which are null!\nIn theory the DB should prevent something like this...", payload);
return mucs.Where(m => !(m is null));
}
return mucs;
}

Expand Down

0 comments on commit d3a8e09

Please sign in to comment.