Skip to content

Commit

Permalink
Fix undefined return value when tracing with format and the return va…
Browse files Browse the repository at this point in the history
…lue is 0x0
  • Loading branch information
as0ler authored and trufae committed Feb 24, 2023
1 parent 623e5bb commit 938482d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/agent/lib/debug/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,16 +477,16 @@ function _cloneArgs(args: string[], fmt: string) {
return a;
}

function _formatRetval(retval: any, fmt: any) {
if (retval !== undefined && !retval.isNull()) {
function _formatRetval(retval: any, fmt: string) {
if (fmt !== undefined) {
const retToken = fmt.indexOf('%');
if (retToken !== -1 && fmt[retToken + 1] !== undefined) {
try {
return _format(retval, fmt[retToken + 1]);
} catch (e: any) { }
}
return retval;
}
return retval;
}

function _formatArgs(args: string[], fmt: string) {
Expand Down

0 comments on commit 938482d

Please sign in to comment.