Skip to content

Commit

Permalink
Small fix to -[GPBEnumDescriptor getValue:forEnumTextFormatName:]
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thomasvl committed Dec 18, 2018
1 parent cecba29 commit 4c55931
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions objectivec/GPBDescriptor.m
Original file line number Diff line number Diff line change
Expand Up @@ -872,11 +872,10 @@ - (BOOL)getValue:(int32_t *)outValue forEnumTextFormatName:(NSString *)textForma
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;
}
Expand Down

0 comments on commit 4c55931

Please sign in to comment.