1
0
mirror of https://github.com/google/benchmark.git synced 2025-04-29 14:30:37 +08:00

Check families is not nullptr before using it

When there's no benchmarks, families becomes nullptr. So before touching
it, we need to ensure families is not nullptr.
This commit is contained in:
Yusuke Suzuki 2014-02-23 20:10:50 +09:00
parent 254a6f9a78
commit 45b79c3e01
3 changed files with 3 additions and 0 deletions

View File

@ -14,3 +14,4 @@ Dominic Hamon <dma@stripysock.com>
Eugene Zhuk <eugene.zhuk@gmail.com>
Google Inc.
Oleksandr Sochka <sasha.sochka@gmail.com>
Yusuke Suzuki <utatane.tea@gmail.com>

View File

@ -28,3 +28,4 @@ Dominic Hamon <dma@stripysock.com>
Eugene Zhuk <eugene.zhuk@gmail.com>
Oleksandr Sochka <sasha.sochka@gmail.com>
Pierre Phaneuf <pphaneuf@google.com>
Yusuke Suzuki <utatane.tea@gmail.com>

View File

@ -757,6 +757,7 @@ void Benchmark::FindBenchmarks(const std::string& spec,
}
mutex_lock l(&benchmark_mutex);
if (families == nullptr) return; // There's no families.
for (Benchmark* family : *families) {
if (family == nullptr) continue; // Family was deleted