test-generated-code2.c: Don't call memcmp with a NULL pointer

This commit is contained in:
Ilya Lipnitskiy 2015-12-12 17:43:01 -08:00
parent e2d45cbe84
commit 8debedbc3c

View File

@ -96,6 +96,8 @@ binary_data_equals (ProtobufCBinaryData a, ProtobufCBinaryData b)
{ {
if (a.len != b.len) if (a.len != b.len)
return 0; return 0;
if (a.len == 0 && b.len == 0)
return 1;
return memcmp (a.data, b.data, a.len) == 0; return memcmp (a.data, b.data, a.len) == 0;
} }