Fixed issues relating to event_sender_name being nullable for some reason.

This commit is contained in:
flash 2023-11-04 23:37:02 +00:00
parent a7a05f04bd
commit 05fcbcb0f8

View file

@ -62,7 +62,7 @@ namespace SharpChat.EventStorage
new MySqlParameter("flags", (byte)flags),
new MySqlParameter("data", data == null ? "{}" : JsonSerializer.SerializeToUtf8Bytes(data)),
new MySqlParameter("sender", senderId < 1 ? null : senderId),
new MySqlParameter("sender_name", string.IsNullOrWhiteSpace(senderName) ? null : senderName),
new MySqlParameter("sender_name", senderName),
new MySqlParameter("sender_colour", senderColour.ToMisuzu()),
new MySqlParameter("sender_rank", senderRank),
new MySqlParameter("sender_nick", string.IsNullOrWhiteSpace(senderNick) ? null : senderNick),
@ -80,7 +80,7 @@ namespace SharpChat.EventStorage
id, type,
channel?.Name,
user?.UserId ?? 0,
user?.UserName,
user?.UserName ?? string.Empty,
user?.Colour ?? ChatColour.None,
user?.Rank ?? 0,
user?.NickName,
@ -122,7 +122,7 @@ namespace SharpChat.EventStorage
Encoding.ASCII.GetString((byte[])reader["event_type"]),
reader.IsDBNull(reader.GetOrdinal("event_sender")) ? null : new ChatUser(
reader.GetInt64("event_sender"),
reader.GetString("event_sender_name"),
reader.IsDBNull(reader.GetOrdinal("event_sender_name")) ? string.Empty : reader.GetString("event_sender_name"),
ChatColour.FromMisuzu(reader.GetInt32("event_sender_colour")),
reader.GetInt32("event_sender_rank"),
(ChatUserPermissions)reader.GetInt32("event_sender_perms"),