Explorar el Código

ts: Validate `error.data` exists on simulation response (#2508)

Sergo hace 2 años
padre
commit
a88be4209a
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      ts/packages/anchor/src/utils/rpc.ts

+ 1 - 1
ts/packages/anchor/src/utils/rpc.ts

@@ -195,7 +195,7 @@ export async function simulateTransaction(
   if ("error" in res) {
     let logs;
     if ("data" in res.error) {
-      logs = res.error.data.logs;
+      logs = res.error.data?.logs;
       if (logs && Array.isArray(logs)) {
         const traceIndent = "\n    ";
         const logTrace = traceIndent + logs.join(traceIndent);