During bootstrapping, the script's name is not necessarily set.
authorjochen@chromium.org <jochen@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 20 Aug 2013 08:06:48 +0000 (08:06 +0000)
committerjochen@chromium.org <jochen@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 20 Aug 2013 08:06:48 +0000 (08:06 +0000)
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

src/isolate.cc

index 7b77d89..653ff2e 100644 (file)
@@ -1400,17 +1400,19 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) {
       // to the console for easier debugging.
       int line_number = GetScriptLineNumberSafe(location->script(),
                                                 location->start_pos());
-      if (exception->IsString()) {
+      if (exception->IsString() && location->script()->name()->IsString()) {
         OS::PrintError(
             "Extension or internal compilation error: %s in %s at line %d.\n",
             *String::cast(exception)->ToCString(),
             *String::cast(location->script()->name())->ToCString(),
             line_number + 1);
-      } else {
+      } else if (location->script()->name()->IsString()) {
         OS::PrintError(
             "Extension or internal compilation error in %s at line %d.\n",
             *String::cast(location->script()->name())->ToCString(),
             line_number + 1);
+      } else {
+        OS::PrintError("Extension or internal compilation error.\n");
       }
     }
   }