refactor: use safe getter at SFX validation assets check
@@ -1633,13 +1633,13 @@ impl<T: Config> Pallet<T> {
e
})?;
- if index < side_effects.len() - 1
- && side_effects[index].reward_asset_id != side_effects[index + 1].reward_asset_id
- {
+ if let Some(next) = side_effects.get(index + 1) {
+ if sfx.reward_asset_id != next.reward_asset_id {
return Err(
"SFX validate failed - enforce all SFX to have the same reward asset field",
)
}
+ }
let (insurance, reward) = if let Some(insurance_and_reward) =
UniversalSideEffectsProtocol::ensure_required_insurance::<
