Index: src/accessors.cc |
diff --git a/src/accessors.cc b/src/accessors.cc |
index 37404837adeb1892c2d8d5a0e82a7fe8d4c63c23..665c2a9de15c3070652637d1b2b95d7713f14e90 100644 |
--- a/src/accessors.cc |
+++ b/src/accessors.cc |
@@ -680,14 +680,16 @@ void Accessors::ScriptEvalFromFunctionNameGetter( |
Handle<Object> object = Utils::OpenHandle(*info.This()); |
Handle<Script> script( |
Script::cast(Handle<JSValue>::cast(object)->value()), isolate); |
- Handle<Object> result; |
- Handle<SharedFunctionInfo> shared( |
- SharedFunctionInfo::cast(script->eval_from_shared())); |
- // Find the name of the function calling eval. |
- if (!shared->name()->IsUndefined()) { |
- result = Handle<Object>(shared->name(), isolate); |
- } else { |
- result = Handle<Object>(shared->inferred_name(), isolate); |
+ Handle<Object> result = isolate->factory()->undefined_value(); |
+ if (!script->eval_from_shared()->IsUndefined()) { |
+ Handle<SharedFunctionInfo> shared( |
+ SharedFunctionInfo::cast(script->eval_from_shared())); |
+ // Find the name of the function calling eval. |
+ if (!shared->name()->IsUndefined()) { |
+ result = Handle<Object>(shared->name(), isolate); |
+ } else { |
+ result = Handle<Object>(shared->inferred_name(), isolate); |
+ } |
} |
info.GetReturnValue().Set(Utils::ToLocal(result)); |
} |