Skip to content

Commit

Permalink
Fix infinite loop in event deserialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
arqunis authored and GnomedDev committed Mar 25, 2024
1 parent 99a0d9e commit e4b9313
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/internal/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ pub(crate) fn join_to_string(
// Required because of https://github.com/Crazytieguy/gat-lending-iterator/issues/31
macro_rules! lending_for_each {
($iter:expr, |$item:ident| $body:expr ) => {
while let Some(mut $item) = $iter.next() {
let mut __iter = $iter;
while let Some(mut $item) = __iter.next() {
$body
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/model/application/command_interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ impl<'de> Deserialize<'de> for CommandInteraction {
interaction.user = member.user.clone();
}

let mut role_iter = interaction.data.resolved.roles.iter_mut();
lending_for_each!(role_iter, |r| r.guild_id = guild_id);
let iter = interaction.data.resolved.roles.iter_mut();
lending_for_each!(iter, |r| r.guild_id = guild_id);
}
Ok(interaction)
}
Expand Down

0 comments on commit e4b9313

Please sign in to comment.