From f0e6418fc1c237c1c1d71834c26a396f0b8ab28e Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 28 Oct 2011 16:27:11 +0200 Subject: [PATCH] Debugger: Don't crash in v8 profiler service if client sends false on startup Change-Id: I2a10536db749d4edd8c2958ef4c87124ddda4d47 Reviewed-by: Aurindam Jana --- src/declarative/debugger/qv8profilerservice.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/declarative/debugger/qv8profilerservice.cpp b/src/declarative/debugger/qv8profilerservice.cpp index 92a1916..e74ccbc 100644 --- a/src/declarative/debugger/qv8profilerservice.cpp +++ b/src/declarative/debugger/qv8profilerservice.cpp @@ -184,9 +184,11 @@ void QV8ProfilerService::stopProfiling(const QString &title) v8::HandleScope handle_scope; v8::Handle v8title = v8::String::New(reinterpret_cast(title.data()), title.size()); const v8::CpuProfile *cpuProfile = v8::CpuProfiler::StopProfiling(v8title); - const v8::CpuProfileNode *rootNode = cpuProfile->GetTopDownRoot(); - - d->printProfileTree(rootNode); + if (cpuProfile) { + // can happen at start + const v8::CpuProfileNode *rootNode = cpuProfile->GetTopDownRoot(); + d->printProfileTree(rootNode); + } } void QV8ProfilerServicePrivate::printProfileTree(const v8::CpuProfileNode *node, int level) -- 2.7.4