From 5ad00f82c6ade834e2cffddaa3293321aae18eb6 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 25 Jan 2011 15:50:12 -0800 Subject: [PATCH] debugger: Don't crash when evaling buffer --- lib/_debugger.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/_debugger.js b/lib/_debugger.js index f501a76799..c23e3fc3df 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -141,7 +141,7 @@ exports.Client = Client; Client.prototype._addHandle = function(desc) { if (typeof desc != 'object' || typeof desc.handle != 'number') { - throw new Error('bad type'); + return; } this.handles[desc.handle] = desc; @@ -428,7 +428,13 @@ Client.prototype.mirrorObject = function(handle, cb) { for (var i = 0; i < handle.properties.length; i++) { 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) && typeof handle.properties[i].name != 'number') {