aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar stone4774 <stone4774@qq.com>2018-03-21 12:25:59 +0800
committerGravatar stone4774 <stone4774@qq.com>2018-03-21 12:25:59 +0800
commitd053271deebe0efcd41729991b1f3d618b638ad5 (patch)
tree4d5ac57b4c124f7176b7a4e87e090be2bd09a580 /src
parent773d8c3329d1a28732d9f9c4b21c02e302052e4f (diff)
Use the first enum value instead of 0 in DefaultValueObjectWriter::FindEnumDefault
Diffstat (limited to 'src')
-rw-r--r--src/google/protobuf/util/internal/default_value_objectwriter.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/google/protobuf/util/internal/default_value_objectwriter.cc b/src/google/protobuf/util/internal/default_value_objectwriter.cc
index 32e2429b..032cc700 100644
--- a/src/google/protobuf/util/internal/default_value_objectwriter.cc
+++ b/src/google/protobuf/util/internal/default_value_objectwriter.cc
@@ -451,7 +451,7 @@ DataPiece DefaultValueObjectWriter::FindEnumDefault(
}
// We treat the first value as the default if none is specified.
return enum_type->enumvalue_size() > 0
- ? (use_ints_for_enums ? DataPiece(0) : DataPiece(enum_type->enumvalue(0).name(), true))
+ ? (use_ints_for_enums ? DataPiece(enum_type->enumvalue(0).number()) : DataPiece(enum_type->enumvalue(0).name(), true))
: DataPiece::NullData();
}