fix path building crash

This commit is contained in:
Ryan Zhao 2022-03-17 10:13:00 +11:00
parent e73fe4fe31
commit 6bc0177bd4
1 changed files with 5 additions and 1 deletions

View File

@ -204,7 +204,11 @@ public enum OnionRequestAPI {
} else {
return buildPaths(reusing: []).map2 { paths in
if let snode = snode {
return paths.filter { !$0.contains(snode) }.randomElement()!
if let path = paths.filter({ !$0.contains(snode) }).randomElement() {
return path
} else {
throw Error.insufficientSnodes
}
} else {
return paths.randomElement()!
}