Skip to content

Commit

Permalink
debugger: assert test before accessing this.binding
Browse files Browse the repository at this point in the history
PR-URL: #5145
Reviewed-By: Myles Borins <[email protected]>
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
princejwesley authored and rvagg committed Feb 15, 2016
1 parent 4dae8ca commit 7bac743
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/_debug_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function Agent() {

this.first = true;
this.binding = process._debugAPI;
assert(this.binding, 'Debugger agent running without bindings!');

var self = this;
this.binding.onmessage = function(msg) {
Expand All @@ -57,7 +58,6 @@ function Agent() {
};

this.clients = [];
assert(this.binding, 'Debugger agent running without bindings!');
}
util.inherits(Agent, net.Server);

Expand Down
6 changes: 6 additions & 0 deletions test/parallel/test-debug-agent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';
require('../common');
const assert = require('assert');

assert.throws(() => { require('_debug_agent').start(); },
assert.AssertionError);

0 comments on commit 7bac743

Please sign in to comment.