Use safe math when pruning statuses (#1835)

Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
This commit is contained in:
Keith Yeung
2023-10-10 17:32:11 +02:00
committed by GitHub
parent 55f354429c
commit 3f5edc52b2
+1 -1
View File
@@ -1129,7 +1129,7 @@ impl<T: Config> XcmpMessageSource for Pallet<T> {
let pruned = old_statuses_len - statuses.len();
// removing an item from status implies a message being sent, so the result messages must
// be no less than the pruned channels.
statuses.rotate_left(result.len() - pruned);
statuses.rotate_left(result.len().saturating_sub(pruned));
<OutboundXcmpStatus<T>>::put(statuses);