Commit 28ad99fe authored by Will Cory's avatar Will Cory

fix: catch out of bounds errors

parent 352a1056
...@@ -455,6 +455,11 @@ export class CrossChainMessenger { ...@@ -455,6 +455,11 @@ export class CrossChainMessenger {
} }
const withdrawal = withdrawals[multiWithdrawalIndex] const withdrawal = withdrawals[multiWithdrawalIndex]
if (!withdrawal) {
throw new Error(
`withdrawal index ${multiWithdrawalIndex} out of bounds there are ${withdrawals.length} withdrawals`
)
}
messageNonce = withdrawal.nonce messageNonce = withdrawal.nonce
gasLimit = withdrawal.gasLimit gasLimit = withdrawal.gasLimit
} }
...@@ -643,7 +648,13 @@ export class CrossChainMessenger { ...@@ -643,7 +648,13 @@ export class CrossChainMessenger {
message as TransactionLike message as TransactionLike
) )
return messages[multiWithdrawalIndex] const out = messages[multiWithdrawalIndex]
if (!out) {
throw new Error(
`withdrawal index ${multiWithdrawalIndex} out of bounds. There are ${messages.length} withdrawals`
)
}
return out
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment