Browse Source

debugger: Don't crash when evaling buffer

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
5ad00f82c6
  1. 10
      lib/_debugger.js

10
lib/_debugger.js

@ -141,7 +141,7 @@ exports.Client = Client;
Client.prototype._addHandle = function(desc) { Client.prototype._addHandle = function(desc) {
if (typeof desc != 'object' || typeof desc.handle != 'number') { if (typeof desc != 'object' || typeof desc.handle != 'number') {
throw new Error('bad type'); return;
} }
this.handles[desc.handle] = desc; this.handles[desc.handle] = desc;
@ -428,7 +428,13 @@ Client.prototype.mirrorObject = function(handle, cb) {
for (var i = 0; i < handle.properties.length; i++) { for (var i = 0; i < handle.properties.length; i++) {
var value = res.body[handle.properties[i].ref]; var value = res.body[handle.properties[i].ref];
var mirrorValue = value.value ? value.value : value.text; var mirrorValue;
if (value) {
mirrorValue = value.value ? value.value : value.text;
} else {
mirrorValue = '[?]';
}
if (Array.isArray(mirror) && if (Array.isArray(mirror) &&
typeof handle.properties[i].name != 'number') { typeof handle.properties[i].name != 'number') {

Loading…
Cancel
Save