diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-12-12 11:31:51 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-12-12 11:32:48 +0000 |
| commit | 6f45aa9937602f3d03cd83cfb5fb3c541fac4adf (patch) | |
| tree | c64277a455b0b8c07c4e501a0716f16365b88c33 /src/bin/git_remote_nostr/utils.rs | |
| parent | 2b49a548169bf9bc3a3ef667a7e952e31e878bab (diff) | |
fix: defend against empty`tags`
prevent a panic when tags are of an unexpect length
Diffstat (limited to 'src/bin/git_remote_nostr/utils.rs')
| -rw-r--r-- | src/bin/git_remote_nostr/utils.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bin/git_remote_nostr/utils.rs b/src/bin/git_remote_nostr/utils.rs index b54ce6b..5efb6e0 100644 --- a/src/bin/git_remote_nostr/utils.rs +++ b/src/bin/git_remote_nostr/utils.rs | |||
| @@ -128,9 +128,9 @@ pub async fn get_open_proposals( | |||
| 128 | .iter() | 128 | .iter() |
| 129 | .filter(|e| { | 129 | .filter(|e| { |
| 130 | status_kinds().contains(&e.kind) | 130 | status_kinds().contains(&e.kind) |
| 131 | && e.tags | 131 | && e.tags.iter().any(|t| { |
| 132 | .iter() | 132 | t.as_slice().len() > 1 && t.as_slice()[1].eq(&proposal.id.to_string()) |
| 133 | .any(|t| t.as_slice()[1].eq(&proposal.id.to_string())) | 133 | }) |
| 134 | }) | 134 | }) |
| 135 | .collect::<Vec<&nostr::Event>>() | 135 | .collect::<Vec<&nostr::Event>>() |
| 136 | .first() | 136 | .first() |