Debugger: Don't crash in v8 profiler service if client sends false on startup
authorKai Koehne <kai.koehne@nokia.com>
Fri, 28 Oct 2011 14:27:11 +0000 (16:27 +0200)
committerQt by Nokia <qt-info@nokia.com>
Sat, 29 Oct 2011 17:33:28 +0000 (19:33 +0200)
Change-Id: I2a10536db749d4edd8c2958ef4c87124ddda4d47
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
src/declarative/debugger/qv8profilerservice.cpp

index 92a1916..e74ccbc 100644 (file)
@@ -184,9 +184,11 @@ void QV8ProfilerService::stopProfiling(const QString &title)
     v8::HandleScope handle_scope;
     v8::Handle<v8::String> v8title = v8::String::New(reinterpret_cast<const uint16_t*>(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)