Small fix to -[GPBEnumDescriptor getValue:forEnumTextFormatName:]

Don't look up the TextFormat for the value as aliases can trip that
up, instead check the TextFormat names directly and then fetch the
value.
This commit is contained in:
Thomas Van Lenten 2018-12-17 17:19:10 -05:00
parent cecba296b8
commit 4c559316e0

View File

@ -872,11 +872,10 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
if (nameOffsets_ == NULL) return NO;
for (uint32_t i = 0; i < valueCount_; ++i) {
int32_t value = values_[i];
NSString *valueTextFormatName = [self textFormatNameForValue:value];
NSString *valueTextFormatName = [self getEnumTextFormatNameForIndex:i];
if ([valueTextFormatName isEqual:textFormatName]) {
if (outValue) {
*outValue = value;
*outValue = values_[i];
}
return YES;
}