Commit 76a820a9 authored by jochen@chromium.org's avatar jochen@chromium.org

During bootstrapping, the script's name is not necessarily set.

So check whether the name is actually set before printing it when
throwing an exception.

BUG=none
R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/23283011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16233 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9929a9cd
...@@ -1400,17 +1400,19 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) { ...@@ -1400,17 +1400,19 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) {
// to the console for easier debugging. // to the console for easier debugging.
int line_number = GetScriptLineNumberSafe(location->script(), int line_number = GetScriptLineNumberSafe(location->script(),
location->start_pos()); location->start_pos());
if (exception->IsString()) { if (exception->IsString() && location->script()->name()->IsString()) {
OS::PrintError( OS::PrintError(
"Extension or internal compilation error: %s in %s at line %d.\n", "Extension or internal compilation error: %s in %s at line %d.\n",
*String::cast(exception)->ToCString(), *String::cast(exception)->ToCString(),
*String::cast(location->script()->name())->ToCString(), *String::cast(location->script()->name())->ToCString(),
line_number + 1); line_number + 1);
} else { } else if (location->script()->name()->IsString()) {
OS::PrintError( OS::PrintError(
"Extension or internal compilation error in %s at line %d.\n", "Extension or internal compilation error in %s at line %d.\n",
*String::cast(location->script()->name())->ToCString(), *String::cast(location->script()->name())->ToCString(),
line_number + 1); line_number + 1);
} else {
OS::PrintError("Extension or internal compilation error.\n");
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment