Skip to content

Commit

Permalink
Fix unsafe array access in internalSourceBreakpoint
Browse files Browse the repository at this point in the history
The stackTrace.callFrames property of the
Protocol.Runtime.ConsoleAPICalledEvent
can be an empty array in certain conditions.
See microsoft#334
  • Loading branch information
jhnns committed Jun 16, 2018
1 parent 65da915 commit 75e3042
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/chrome/internalSourceBreakpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class InternalSourceBreakpoint {
}

function isLogpointMessage(m: Crdp.Runtime.ConsoleAPICalledEvent): boolean {
return m.stackTrace && m.stackTrace.callFrames[0].url === InternalSourceBreakpoint.LOGPOINT_URL;
return m.stackTrace && m.stackTrace.callFrames.length > 0 && m.stackTrace.callFrames[0].url === InternalSourceBreakpoint.LOGPOINT_URL;
}

export function stackTraceWithoutLogpointFrame(m: Crdp.Runtime.ConsoleAPICalledEvent): Crdp.Runtime.StackTrace {
Expand Down

0 comments on commit 75e3042

Please sign in to comment.