Skip to content

Commit

Permalink
Merge pull request protocolbuffers#2985 from thomasvl/class_check_tweaks
Browse files Browse the repository at this point in the history
Tighten up class usage/checks.
  • Loading branch information
thomasvl authored Apr 18, 2017
2 parents 8aa927f + f5a01d1 commit a3873ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions objectivec/GPBMessage.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static id GetOrCreateMapIvarWithField(GPBMessage *self,

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 %@)",
Expand Down Expand Up @@ -3189,7 +3189,7 @@ + (BOOL)resolveInstanceMethod:(SEL)sel {

+ (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];
Expand Down

0 comments on commit a3873ca

Please sign in to comment.