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