[vm] Behave more gracefully for kernel-based Scripts that lack source (i.e., from a core snapshot).

Change-Id: Ie3a40a4ceb85e450f47f46a019626a0b553c14c7
Reviewed-on: https://dart-review.googlesource.com/74661
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
diff --git a/runtime/vm/object_service.cc b/runtime/vm/object_service.cc
index 7812ac5..502e0ed 100644
--- a/runtime/vm/object_service.cc
+++ b/runtime/vm/object_service.cc
@@ -454,11 +454,11 @@
   }
 
   // Print the line number table
-  if (!source.IsNull()) {
+  const GrowableObjectArray& lineNumberArray =
+      GrowableObjectArray::Handle(GenerateLineNumberArray());
+  if (!lineNumberArray.IsNull()) {
     JSONArray tokenPosTable(&jsobj, "tokenPosTable");
 
-    const GrowableObjectArray& lineNumberArray =
-        GrowableObjectArray::Handle(GenerateLineNumberArray());
     Object& value = Object::Handle();
     intptr_t pos = 0;
 
diff --git a/runtime/vm/report.cc b/runtime/vm/report.cc
index ac3989d..f681530 100644
--- a/runtime/vm/report.cc
+++ b/runtime/vm/report.cc
@@ -44,7 +44,7 @@
       UNREACHABLE();
   }
   String& result = String::Handle();
-  if (!script.IsNull()) {
+  if (!script.IsNull() && !String::Handle(script.Source()).IsNull()) {
     const String& script_url = String::Handle(script.url());
     if (token_pos.IsReal()) {
       intptr_t line, column, token_len;