| Index: runtime/vm/flow_graph_builder.cc
|
| diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
|
| index 87cdd133fae022dc37852f1e991fdd10bc10dfb8..ea31f9653e4c77fce2329fbcef353c204a2d29d2 100644
|
| --- a/runtime/vm/flow_graph_builder.cc
|
| +++ b/runtime/vm/flow_graph_builder.cc
|
| @@ -2530,16 +2530,17 @@ void EffectGraphVisitor::VisitStringInterpolateNode(
|
| static void CollectClosureFunction(const Function& function) {
|
| if (function.HasCode()) return;
|
|
|
| + // Although this is only called when precompiling, this can happen before
|
| + // Dart_Precompile as part of loading code, so check for a non-null work
|
| + // list.
|
| Thread* thread = Thread::Current();
|
| Isolate* isolate = thread->isolate();
|
| - if (isolate->collected_closures() == GrowableObjectArray::null()) {
|
| - isolate->set_collected_closures(
|
| - GrowableObjectArray::Handle(GrowableObjectArray::New()));
|
| - }
|
| - const GrowableObjectArray& functions =
|
| - GrowableObjectArray::Handle(thread->zone(),
|
| - isolate->collected_closures());
|
| - functions.Add(function);
|
| + if (isolate->collected_closures() != GrowableObjectArray::null()) {
|
| + const GrowableObjectArray& functions =
|
| + GrowableObjectArray::Handle(thread->zone(),
|
| + isolate->collected_closures());
|
| + functions.Add(function);
|
| + }
|
| }
|
|
|
|
|
|
|