diff options
author | Guantao Liu <guantaol@google.com> | 2018-10-02 18:34:59 -0700 |
---|---|---|
committer | Guantao Liu <guantaol@google.com> | 2018-10-02 19:45:35 -0700 |
commit | e6824674f428362ba8a8011ce34ca5e83abb0fe5 (patch) | |
tree | 5e1d357b0ac159571c33d1f7b052d052c0872b8f | |
parent | 668a16327b28285bc13864de13ed43f38e1fe7a8 (diff) |
Cover the case that there is no command-line argument.
-rw-r--r-- | test/core/iomgr/resolve_address_test.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/core/iomgr/resolve_address_test.cc b/test/core/iomgr/resolve_address_test.cc index 7c9d8e8913..8d69bab5b1 100644 --- a/test/core/iomgr/resolve_address_test.cc +++ b/test/core/iomgr/resolve_address_test.cc @@ -254,7 +254,7 @@ int main(int argc, char** argv) { // In case that there are more than one argument on the command line, // --resolver will always be the first one, so only parse the first argument // (other arguments may be unknown to cl) - gpr_cmdline_parse(cl, 2, argv); + gpr_cmdline_parse(cl, argc > 2 ? 2 : argc, argv); const char* cur_resolver = gpr_getenv("GRPC_DNS_RESOLVER"); if (cur_resolver != nullptr && strlen(cur_resolver) != 0) { gpr_log(GPR_INFO, "Warning: overriding resolver setting of %s", |