fix: deserialize sync event body

This commit is contained in:
timokoesters 2020-04-03 21:17:27 +02:00
parent 2855d1acdf
commit f9cfede2a8
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
4 changed files with 48 additions and 36 deletions

View file

@ -84,8 +84,11 @@ where
body: t,
user_id,
// TODO: Can we avoid parsing it again?
json_body: serde_json::from_slice(&body)
.expect("Ruma already parsed it successfuly"),
json_body: if !body.is_empty() {
serde_json::from_slice(&body).expect("Ruma already parsed it successfully")
} else {
serde_json::Value::default()
},
}),
Err(e) => {
log::error!("{:?}", e);