diff --git a/share/server/dreyfus.js b/share/server/dreyfus.js index 3aa72493f8..8a4b8396d3 100644 --- a/share/server/dreyfus.js +++ b/share/server/dreyfus.js @@ -17,7 +17,7 @@ var Dreyfus = (function() { function handleIndexError(err, doc) { if (err == "fatal_error") { throw(["error", "map_runtime_error", "function raised 'fatal_error'"]); - } else if (err[0] == "fatal") { + } else if (err && err[0] == "fatal") { throw(err); } var message = "function raised exception " + errstr(err); diff --git a/share/server/nouveau.js b/share/server/nouveau.js index 8c75d4a250..a42751e81d 100644 --- a/share/server/nouveau.js +++ b/share/server/nouveau.js @@ -17,7 +17,7 @@ var Nouveau = (function () { function handleIndexError(err, doc) { if (err == "fatal_error") { throw (["error", "map_runtime_error", "function raised 'fatal_error'"]); - } else if (err[0] == "fatal") { + } else if (err && err[0] == "fatal") { throw (err); } var message = "function raised exception " + err.toSource(); diff --git a/share/server/views.js b/share/server/views.js index d414436bd9..efb269bb91 100644 --- a/share/server/views.js +++ b/share/server/views.js @@ -70,7 +70,7 @@ var Views = (function() { // JavaScript process. If you need to destroy the JavaScript // process, throw the error form matched by the block below. throw(["error", "map_runtime_error", "function raised 'fatal_error'"]); - } else if (err[0] == "fatal") { + } else if (err && err[0] == "fatal") { // Throwing errors of the form ["fatal","error_key","reason"] // will kill the OS process. This is not normally what you want. throw(err);