diff --git a/bindings/profilers/heap.cc b/bindings/profilers/heap.cc index 7c6eaad4..fa81f742 100644 --- a/bindings/profilers/heap.cc +++ b/bindings/profilers/heap.cc @@ -571,6 +571,9 @@ NAN_METHOD(HeapProfiler::GetAllocationProfile) { auto isolate = info.GetIsolate(); std::unique_ptr profile( isolate->GetHeapProfiler()->GetAllocationProfile()); + if (!profile) { + return Nan::ThrowError("Heap profiler is not enabled."); + } v8::AllocationProfile::Node* root = profile->GetRootNode(); auto state = PerIsolateData::For(isolate)->GetHeapProfilerState(); if (state) {