use array access function (#23895)

This commit is contained in:
Jack May 2022-03-23 17:03:01 -07:00 committed by GitHub
parent 0c0db9308b
commit 486f7b7673
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -416,7 +416,13 @@ impl Accounts {
error_counters: &mut ErrorCounters,
) -> Result<Vec<usize>> {
let mut account_indices = Vec::new();
let mut program_id = accounts[program_account_index].0;
let mut program_id = match accounts.get(program_account_index) {
Some(program_account) => program_account.0,
None => {
error_counters.account_not_found += 1;
return Err(TransactionError::ProgramAccountNotFound);
}
};
let mut depth = 0;
while !native_loader::check_id(&program_id) {
if depth >= 5 {