From 91cbb57cd5cd012d5aa66bfb6eb3a1306271f431 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Wed, 12 Sep 2018 19:51:43 +0000 Subject: [PATCH] [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 Reviewed-by: Ben Konyi Commit-Queue: Ryan Macnak --- runtime/vm/object_service.cc | 6 +++--- runtime/vm/report.cc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/vm/object_service.cc b/runtime/vm/object_service.cc index 7812ac543ec..502e0edf1d3 100644 --- a/runtime/vm/object_service.cc +++ b/runtime/vm/object_service.cc @@ -454,11 +454,11 @@ void Script::PrintJSONImpl(JSONStream* stream, bool ref) const { } // 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 ac3989deab8..f68153030a6 100644 --- a/runtime/vm/report.cc +++ b/runtime/vm/report.cc @@ -44,7 +44,7 @@ RawString* Report::PrependSnippet(Kind kind, 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;