fix potential crash when displaying audit log

This commit is contained in:
ouwou
2021-05-14 02:44:07 -04:00
parent 09cb0b07bb
commit cd97c55465
3 changed files with 45 additions and 41 deletions

View File

@@ -20,7 +20,7 @@ void from_json(const nlohmann::json &j, AuditLogOptions &m) {
void from_json(const nlohmann::json &j, AuditLogEntry &m) {
JS_N("target_id", m.TargetID);
JS_O("changes", m.Changes);
JS_D("user_id", m.UserID);
JS_N("user_id", m.UserID);
JS_D("id", m.ID);
JS_D("action_type", m.Type);
JS_O("options", m.Options);

View File

@@ -66,7 +66,7 @@ struct AuditLogOptions {
struct AuditLogEntry {
Snowflake ID;
std::string TargetID; // null
Snowflake UserID;
std::optional<Snowflake> UserID;
AuditLogActionType Type;
std::optional<std::string> Reason;
std::optional<std::vector<AuditLogChange>> Changes;