ASSERT vector size before directly accessing first element

pull/7020/head
Robbie Shade 9 years ago
parent 60e98ec3fe
commit 820c1f3fda
  1. 2
      test/cpp/end2end/end2end_test.cc

@ -1407,7 +1407,7 @@ TEST_P(SecureEnd2endTest, ClientAuthContext) {
std::shared_ptr<const AuthContext> auth_ctx = context.auth_context(); std::shared_ptr<const AuthContext> auth_ctx = context.auth_context();
std::vector<grpc::string_ref> tst = std::vector<grpc::string_ref> tst =
auth_ctx->FindPropertyValues("transport_security_type"); auth_ctx->FindPropertyValues("transport_security_type");
EXPECT_EQ(1u, tst.size()); ASSERT_EQ(1u, tst.size());
EXPECT_EQ(GetParam().credentials_type, ToString(tst[0])); EXPECT_EQ(GetParam().credentials_type, ToString(tst[0]));
if (GetParam().credentials_type == kTlsCredentialsType) { if (GetParam().credentials_type == kTlsCredentialsType) {
EXPECT_EQ("x509_subject_alternative_name", EXPECT_EQ("x509_subject_alternative_name",

Loading…
Cancel
Save