diff options
-rw-r--r-- | test/core/end2end/cq_verifier.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c index 66480254d2..7822d001d1 100644 --- a/test/core/end2end/cq_verifier.c +++ b/test/core/end2end/cq_verifier.c @@ -127,11 +127,15 @@ static gpr_slice merge_slices(gpr_slice *slices, size_t nslices) { } static int byte_buffer_eq_slice(grpc_byte_buffer *bb, gpr_slice b) { - gpr_slice a = - merge_slices(bb->data.slice_buffer.slices, bb->data.slice_buffer.count); - int ok = GPR_SLICE_LENGTH(a) == GPR_SLICE_LENGTH(b) && - 0 == memcmp(GPR_SLICE_START_PTR(a), GPR_SLICE_START_PTR(b), - GPR_SLICE_LENGTH(a)); + gpr_slice a; + int ok; + + if (!bb) return 0; + + a = merge_slices(bb->data.slice_buffer.slices, bb->data.slice_buffer.count); + ok = GPR_SLICE_LENGTH(a) == GPR_SLICE_LENGTH(b) && + 0 == memcmp(GPR_SLICE_START_PTR(a), GPR_SLICE_START_PTR(b), + GPR_SLICE_LENGTH(a)); gpr_slice_unref(a); gpr_slice_unref(b); return ok; |