diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2017-04-18 13:10:52 -0400 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2017-04-18 13:10:52 -0400 |
commit | f5a01d1bbdb003e02fb32e1d4f5dffffdcae6bdf (patch) | |
tree | cfe6aceeba47e8d12293375c85f4fc8f2d31e66c /objectivec/GPBMessage.m | |
parent | 8aa927f08f6b92808976b0c22fa4a45850279987 (diff) | |
download | protobuf-f5a01d1bbdb003e02fb32e1d4f5dffffdcae6bdf.tar.gz protobuf-f5a01d1bbdb003e02fb32e1d4f5dffffdcae6bdf.tar.bz2 protobuf-f5a01d1bbdb003e02fb32e1d4f5dffffdcae6bdf.zip |
Tighten up class usage/checks.
- Ensure extensions resolution/wiring is happening directly on the
messageClass (incase someone is doing odd things our out classes).
- Make the extension message check match the other class checks in
for mergeFrom/isEqual/etc.
Diffstat (limited to 'objectivec/GPBMessage.m')
-rw-r--r-- | objectivec/GPBMessage.m | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/objectivec/GPBMessage.m b/objectivec/GPBMessage.m index 78935b19..627a396e 100644 --- a/objectivec/GPBMessage.m +++ b/objectivec/GPBMessage.m @@ -130,7 +130,7 @@ static NSError *ErrorFromException(NSException *exception) { static void CheckExtension(GPBMessage *self, GPBExtensionDescriptor *extension) { - if ([self class] != extension.containingMessageClass) { + if (![self isKindOfClass:extension.containingMessageClass]) { [NSException raise:NSInvalidArgumentException format:@"Extension %@ used on wrong class (%@ instead of %@)", @@ -3189,7 +3189,7 @@ static void ResolveIvarSet(GPBFieldDescriptor *field, + (BOOL)resolveClassMethod:(SEL)sel { // Extensions scoped to a Message and looked up via class methods. - if (GPBResolveExtensionClassMethod(self, sel)) { + if (GPBResolveExtensionClassMethod([self descriptor].messageClass, sel)) { return YES; } return [super resolveClassMethod:sel]; |