lib/ur: Prevent panic when blocksResult is nil (ref #7495) (#7515)

This commit is contained in:
Simon Frei
2021-03-22 15:07:41 +01:00
committed by GitHub
parent bc08a951f1
commit 6b25eb2e79
+3 -3
View File
@@ -426,12 +426,12 @@ func CpuBench(ctx context.Context, iterations int, duration time.Duration, useWe
perf = v perf = v
} }
} }
if blocksResult == nil {
// not looking at the blocksResult makes it unused from a static // not looking at the blocksResult makes it unused from a static
// analysis / compiler standpoint... // analysis / compiler standpoint...
panic("blocksResult should have been set by benchmark loop") // blocksResult may be nil at this point if the context is cancelled
} if blocksResult != nil {
blocksResult = nil blocksResult = nil
}
return perf return perf
} }