From b39663df611a6744bbc7126980c3e9b58de0486e Mon Sep 17 00:00:00 2001 From: Valdemar Erk Date: Thu, 4 Jul 2024 23:15:45 +0200 Subject: [PATCH] fix(model): Entitlements would only deserialize it was before data closes #2358 --- twilight-model/src/application/interaction/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/twilight-model/src/application/interaction/mod.rs b/twilight-model/src/application/interaction/mod.rs index 2bd0397110d..9c634f37d8a 100644 --- a/twilight-model/src/application/interaction/mod.rs +++ b/twilight-model/src/application/interaction/mod.rs @@ -210,7 +210,7 @@ impl<'de> Visitor<'de> for InteractionVisitor { let mut channel: Option = None; let mut channel_id: Option> = None; let mut data: Option = None; - let mut entitlements: Vec = Vec::new(); + let mut entitlements: Option> = None; let mut guild_id: Option> = None; let mut guild_locale: Option = None; let mut id: Option> = None; @@ -269,7 +269,7 @@ impl<'de> Visitor<'de> for InteractionVisitor { data = map.next_value()?; } InteractionField::Entitlements => { - if data.is_some() { + if entitlements.is_some() { return Err(DeError::duplicate_field("entitlements")); } @@ -387,6 +387,8 @@ impl<'de> Visitor<'de> for InteractionVisitor { } }; + let entitlements = entitlements.unwrap_or_default(); + Ok(Self::Value { app_permissions, application_id,