Skip to content

Commit

Permalink
chore: Skip decoding instructions with broken instruction parser
Browse files Browse the repository at this point in the history
  • Loading branch information
CCristi committed Jun 25, 2024
1 parent ae76e16 commit e7caec8
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@ export function decodeInstruction(idls: IdlsMap, instruction: Instruction): Inst
};

let parser = idls.get(programId);
if (parser == null) {
if (!parser) {
return parsedInstruction; // Short-circuit without decodedData since IDL is missing
}
let instructionParser = parser.createParser(ParserType.INSTRUCTION);

let instructionParser;
try {
instructionParser = parser.createParser(ParserType.INSTRUCTION);
} catch {
return parsedInstruction; // Short-circuit without instructionParser we can't decode the instruction
}

if (!instructionParser || !checkIfInstructionParser(instructionParser)) {
return parsedInstruction; // Short-circuit without decodedData parser can't be created
Expand Down

0 comments on commit e7caec8

Please sign in to comment.