From 683f6ebe3720c11f12e536f70ed1aaad5b21b937 Mon Sep 17 00:00:00 2001 From: Dave Olszewski Date: Fri, 27 Jan 2017 10:53:12 -0800 Subject: [PATCH] Throw exception instead of segfaulting if not profiling --- src/cpu_profiler.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cpu_profiler.cc b/src/cpu_profiler.cc index 949c725..d1511aa 100644 --- a/src/cpu_profiler.cc +++ b/src/cpu_profiler.cc @@ -56,6 +56,10 @@ namespace nodex { profile = v8::CpuProfiler::StopProfiling(title); #endif + if (profile == NULL) { + return Nan::ThrowError("Not profiling"); + } + info.GetReturnValue().Set(Profile::New(profile)); }