Browse Source

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.
Thomas Van Lenten 6 years ago
parent
commit
4c559316e0
1 changed files with 2 additions and 3 deletions
  1. 2 3
      objectivec/GPBDescriptor.m

+ 2 - 3
objectivec/GPBDescriptor.m

@@ -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;
         }