diff --git a/Userland/Libraries/LibJS/Runtime/ArrayIterator.cpp b/Userland/Libraries/LibJS/Runtime/ArrayIterator.cpp index b9e45758ec4..39d428d412d 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayIterator.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayIterator.cpp @@ -9,9 +9,9 @@ namespace JS { -ArrayIterator* ArrayIterator::create(Realm& realm, Value array, Object::PropertyKind iteration_kind) +NonnullGCPtr ArrayIterator::create(Realm& realm, Value array, Object::PropertyKind iteration_kind) { - return realm.heap().allocate(realm, array, iteration_kind, *realm.intrinsics().array_iterator_prototype()); + return *realm.heap().allocate(realm, array, iteration_kind, *realm.intrinsics().array_iterator_prototype()); } ArrayIterator::ArrayIterator(Value array, Object::PropertyKind iteration_kind, Object& prototype) diff --git a/Userland/Libraries/LibJS/Runtime/ArrayIterator.h b/Userland/Libraries/LibJS/Runtime/ArrayIterator.h index e296a85d0de..7bee8031ad2 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayIterator.h +++ b/Userland/Libraries/LibJS/Runtime/ArrayIterator.h @@ -14,7 +14,7 @@ class ArrayIterator final : public Object { JS_OBJECT(ArrayIterator, Object); public: - static ArrayIterator* create(Realm&, Value array, Object::PropertyKind iteration_kind); + static NonnullGCPtr create(Realm&, Value array, Object::PropertyKind iteration_kind); virtual ~ArrayIterator() override = default;