refactor: address panics due to indexing and slicing (#3233)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Shankar Singh C
2024-01-05 14:47:37 +05:30
committed by GitHub
parent 000e644388
commit 34318bc1f1
39 changed files with 244 additions and 253 deletions

View File

@ -417,7 +417,10 @@ impl GenContext {
.position(|v| *v == node_id)
.ok_or_else(|| "Error deciding cycle order".to_string())?;
let cycle_order = order[position..].to_vec();
let cycle_order = order
.get(position..)
.ok_or_else(|| "Error getting cycle order".to_string())?
.to_vec();
Ok(Some(cycle_order))
} else if visited.contains(&node_id) {
Ok(None)