Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ where
games: Option<Vec<String>>,
slots: Option<Vec<String>>,
tags: Vec<String>,
data: serde_json::Value,
data: Option<serde_json::Value>,
) -> Result<(), ArchipelagoError> {
self.send(ClientMessage::Bounce(Bounce {
games,
Expand Down Expand Up @@ -423,7 +423,7 @@ impl ArchipelagoClientSender {
games: Option<Vec<String>>,
slots: Option<Vec<String>>,
tags: Vec<String>,
data: serde_json::Value,
data: Option<serde_json::Value>,
) -> Result<(), ArchipelagoError> {
self.send(ClientMessage::Bounce(Bounce {
games,
Expand Down
13 changes: 8 additions & 5 deletions src/protocol/bounce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct InternalBounced {
pub slots: Option<Vec<i64>>,
#[serde(default)]
pub tags: Vec<String>,
pub data: Value,
pub data: Option<Value>,
}

// Deserialize Bounced based on its tags.
Expand All @@ -36,9 +36,12 @@ impl<'de> Deserialize<'de> for Bounced {
games: internal.games,
slots: internal.slots,
tags: internal.tags,
data: BounceData::DeathLink(match serde_json::from_value(internal.data) {
Ok(data) => data,
Err(err) => return Err(D::Error::custom(err)),
data: BounceData::DeathLink(match internal.data {
None => return Err(D::Error::custom("DeathLink Bounce should have data, but was None.")),
Some(data) => match serde_json::from_value(data) {
Ok(data) => data,
Err(err) => return Err(D::Error::custom(err)),
},
}),
})
} else {
Expand All @@ -55,7 +58,7 @@ impl<'de> Deserialize<'de> for Bounced {
#[derive(Debug, Clone)]
pub enum BounceData {
DeathLink(DeathLink),
Generic(Value),
Generic(Option<Value>),
}

#[serde_as]
Expand Down