mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-22 02:45:08 -04:00
Don't use GetNonWhiteSpaceString()
with nullable JSON fields
Fixes #747
This commit is contained in:
parent
ba4ece9325
commit
a06b448f4a
2 changed files with 2 additions and 2 deletions
|
@ -45,7 +45,7 @@ public partial record Channel
|
|||
public static Channel Parse(JsonElement json, ChannelCategory? category = null, int? position = null)
|
||||
{
|
||||
var id = json.GetProperty("id").GetNonWhiteSpaceString().Pipe(Snowflake.Parse);
|
||||
var guildId = json.GetPropertyOrNull("guild_id")?.GetNonWhiteSpaceString().Pipe(Snowflake.Parse);
|
||||
var guildId = json.GetPropertyOrNull("guild_id")?.GetStringOrNull()?.Pipe(Snowflake.Parse);
|
||||
var topic = json.GetPropertyOrNull("topic")?.GetStringOrNull();
|
||||
var kind = (ChannelKind)json.GetProperty("type").GetInt32();
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public partial record Emoji
|
|||
|
||||
public static Emoji Parse(JsonElement json)
|
||||
{
|
||||
var id = json.GetPropertyOrNull("id")?.GetNonWhiteSpaceString();
|
||||
var id = json.GetPropertyOrNull("id")?.GetStringOrNull();
|
||||
var name = json.GetProperty("name").GetNonWhiteSpaceString();
|
||||
var isAnimated = json.GetPropertyOrNull("animated")?.GetBoolean() ?? false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue