debugger: Fix bug in sb() with unnamed script
authorMaxim Bogushevich <boga1@mail.ru>
Tue, 22 Oct 2013 07:27:02 +0000 (17:27 +1000)
committerFedor Indutny <fedor.indutny@gmail.com>
Fri, 25 Oct 2013 09:17:35 +0000 (13:17 +0400)
setBreakpoint() cause error when unnamed script is loaded

lib/_debugger.js

index 8be2d1e..6202155 100644 (file)
@@ -1374,7 +1374,9 @@ Interface.prototype.setBreakpoint = function(script, line,
     if (script != +script && !this.client.scripts[script]) {
       var scripts = this.client.scripts;
       Object.keys(scripts).forEach(function(id) {
-        if (scripts[id] && scripts[id].name.indexOf(script) !== -1) {
+        if (scripts[id] &&
+            scripts[id].name &&
+            scripts[id].name.indexOf(script) !== -1) {
           if (scriptId) {
             ambiguous = true;
           }