Index: runtime/vm/object.h |
diff --git a/runtime/vm/object.h b/runtime/vm/object.h |
index 0765fcc28fc31f9c6a14df52823b0377d89249e8..4e3919df9ae6b8878231ac8a183e1594b55fc1a0 100644 |
--- a/runtime/vm/object.h |
+++ b/runtime/vm/object.h |
@@ -8200,6 +8200,10 @@ class LinkedHashMap : public Instance { |
} |
intptr_t Length() const { |
+ // The map may be uninitialized. |
+ if (raw_ptr()->used_data_ == Object::null()) return 0; |
+ if (raw_ptr()->deleted_keys_ == Object::null()) return 0; |
+ |
intptr_t used = Smi::Value(raw_ptr()->used_data_); |
intptr_t deleted = Smi::Value(raw_ptr()->deleted_keys_); |
return (used >> 1) - deleted; |