aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-12-17 21:45:25 -0800
committerZeyla Hellyer <[email protected]>2017-12-17 21:46:30 -0800
commit2abeea53745b5ddfce33d9e1160c682888850344 (patch)
tree81b535e64c25b27d5819f5c24caf6442101bce8d /src/model
parentDefault serde on a couple Ready structfields (diff)
downloadserenity-2abeea53745b5ddfce33d9e1160c682888850344.tar.xz
serenity-2abeea53745b5ddfce33d9e1160c682888850344.zip
Fix `Guild` deser without `system_channel_id`
Fix the deserialization of `model::guild::Guild` when `Guild::system_channel_id` is not present. Additionally, add a test case for this.
Diffstat (limited to 'src/model')
-rw-r--r--src/model/guild/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/model/guild/mod.rs b/src/model/guild/mod.rs
index 1011891..8b6ba9d 100644
--- a/src/model/guild/mod.rs
+++ b/src/model/guild/mod.rs
@@ -1509,10 +1509,10 @@ impl<'de> Deserialize<'de> for Guild {
Some(v) => Option::<String>::deserialize(v).map_err(DeError::custom)?,
None => None,
};
- let system_channel_id = map.remove("system_channel_id")
- .ok_or_else(|| DeError::custom("expected guild system_channel_id"))
- .and_then(Option::<ChannelId>::deserialize)
- .map_err(DeError::custom)?;
+ let system_channel_id = match map.remove("system_channel_id") {
+ Some(v) => Option::<ChannelId>::deserialize(v).map_err(DeError::custom)?,
+ None => None,
+ };
let verification_level = map.remove("verification_level")
.ok_or_else(|| DeError::custom("expected guild verification_level"))
.and_then(VerificationLevel::deserialize)