Fix unreachable code return in a case label that has a switch with only a default case in it, which returns already (#8927)

pull/8955/head
Sil3ntStorm 3 years ago committed by GitHub
parent 4368383f0e
commit 7b9b7fe4a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      src/google/protobuf/generated_message_reflection.cc

@ -2491,18 +2491,12 @@ bool Reflection::HasBit(const Message& message,
// (which uses HasField()) needs to be consistent with this.
switch (field->cpp_type()) {
case FieldDescriptor::CPPTYPE_STRING:
switch (field->options().ctype()) {
default: {
if (IsInlined(field)) {
return !GetField<InlinedStringField>(message, field)
.GetNoArena()
.empty();
}
return GetField<ArenaStringPtr>(message, field).Get().size() > 0;
}
if (IsInlined(field)) {
return !GetField<InlinedStringField>(message, field)
.GetNoArena()
.empty();
}
return false;
return GetField<ArenaStringPtr>(message, field).Get().size() > 0;
case FieldDescriptor::CPPTYPE_BOOL:
return GetRaw<bool>(message, field) != false;
case FieldDescriptor::CPPTYPE_INT32:

Loading…
Cancel
Save