Some platforms and environments don't pass a valid argc/argv. (#607)

Specifically some iOS targets.
This commit is contained in:
Dominic Hamon 2018-05-30 13:17:41 +01:00 committed by GitHub
parent d07372e64b
commit 4fbfa2f336
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -568,7 +568,8 @@ void PrintUsageAndExit() {
void ParseCommandLineFlags(int* argc, char** argv) {
using namespace benchmark;
BenchmarkReporter::Context::executable_name = argv[0];
BenchmarkReporter::Context::executable_name =
(argc && *argc > 0) ? argv[0] : "unknown";
for (int i = 1; i < *argc; ++i) {
if (ParseBoolFlag(argv[i], "benchmark_list_tests",
&FLAGS_benchmark_list_tests) ||