From 65a55b6d29c639dc11b67ec9a8c0122cf07b3051 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Thu, 5 Mar 2015 11:07:33 -0800 Subject: [PATCH] Fix when no output --- lib/execjs/external_runtime.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/execjs/external_runtime.rb b/lib/execjs/external_runtime.rb index 7cb0a9d..811dd69 100644 --- a/lib/execjs/external_runtime.rb +++ b/lib/execjs/external_runtime.rb @@ -213,7 +213,9 @@ module ExecJS def exec_runtime_error(output) error = RuntimeError.new(output) - lineno = output.split("\n")[0][/:(\d+)$/, 1] || 1 + lines = output.split("\n") + lineno = lines[0][/:(\d+)$/, 1] if lines[0] + lineno ||= 1 error.set_backtrace(["(execjs):#{lineno}"] + caller) error end