crytpo: Get the session from the list of sessions in a safe manner.
parent
d96c9f85a1
commit
473e49252e
|
@ -365,9 +365,15 @@ impl ReadOnlyDevice {
|
||||||
return Err(EventError::MissingSenderKey.into());
|
return Err(EventError::MissingSenderKey.into());
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut session = if let Some(s) = store.get_sessions(sender_key).await? {
|
let session = if let Some(s) = store.get_sessions(sender_key).await? {
|
||||||
let session = &s.lock().await[0];
|
let sessions = s.lock().await;
|
||||||
session.clone()
|
sessions.get(0).cloned()
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut session = if let Some(s) = session {
|
||||||
|
s
|
||||||
} else {
|
} else {
|
||||||
warn!(
|
warn!(
|
||||||
"Trying to encrypt a Megolm session for user {} on device {}, \
|
"Trying to encrypt a Megolm session for user {} on device {}, \
|
||||||
|
|
Loading…
Reference in New Issue