You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When processing the following json a null reference exception is thrown.
{
"type":"MESSAGE",
"data":{
"topic":"chat_moderator_actions.80153562.80153562",
"message":"{\"type\":\"channel_terms_action\",\"data\":{\"type\":\"add_permitted_term\",\"id\":\"REMOVED\",\"text\":\"crazy ur crazy\",\"requester_id\":\"REMOVED\",\"requester_login\":\"REMOVED\",\"channel_id\":\"REMOVED\",\"expires_at\":\"2021-08-19T06:13:40.169705384Z\",\"updated_at\":\"2021-08-19T05:13:40.169704026Z\",\"from_automod\":true}}"
}
}
There aren't the created_by, created_by_user_id or target_user_id properties, which means a null reference exception is being thrown by the ChatModeratorActions constructor.
So I've changed the constructor of ChatModeratorActions to:
E.g. added ? to json.SelectToken("created_by") etc... The above will then parse but you have to modify the message case in the switch statement to handle that the ModerationAction is null, e.g. update:
case "chat_moderator_actions":
...switch(cma?.ModerationAction.ToLower())
to
case "chat_moderator_actions":
...switch(cma?.ModerationAction?.ToLower())
It will then go through the UnaccountedFor handler rather than throwing the exception.
The text was updated successfully, but these errors were encountered:
When processing the following json a null reference exception is thrown.
There aren't the created_by, created_by_user_id or target_user_id properties, which means a null reference exception is being thrown by the ChatModeratorActions constructor.
So I've changed the constructor of ChatModeratorActions to:
E.g. added ? to json.SelectToken("created_by") etc... The above will then parse but you have to modify the message case in the switch statement to handle that the ModerationAction is null, e.g. update:
to
It will then go through the UnaccountedFor handler rather than throwing the exception.
The text was updated successfully, but these errors were encountered: