Commit aeeda707 authored by Emil Hessman's avatar Emil Hessman Committed by Ian Lance Taylor

runtime: Fix panic when trying to stop CPU profiling with profiler turned off

Fixes #7063.

R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/47950043
parent 79653e41
......@@ -168,7 +168,7 @@ runtime·SetCPUProfileRate(intgo hz)
runtime·noteclear(&prof->wait);
runtime·setcpuprofilerate(tick, hz);
} else if(prof->on) {
} else if(prof != nil && prof->on) {
runtime·setcpuprofilerate(nil, 0);
prof->on = false;
......
......@@ -126,3 +126,8 @@ func TestRuntimeGogoBytes(t *testing.T) {
t.Fatalf("go tool nm did not report size for runtime.gogo")
}
// golang.org/issue/7063
func TestStopCPUProfilingWithProfilerOff(t *testing.T) {
SetCPUProfileRate(0)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment