Merge branch 'feature/nil_class_exception' into 'develop'

improve exception handling

See merge request BPHV_MIPS/mvm_core!196
This commit is contained in:
Hedden, Kyle Matthew 2022-03-01 23:51:06 +00:00
commit 1866c0c28a

View File

@ -141,9 +141,11 @@
}
+ (id)initializerClassCheck:(nullable NSObject *)object classToVerify:(Class)classToVerify {
if (object) {
[self classIsInstanceTypeOfClass:object.class otherClass:classToVerify throwException:YES];
if (!object) { return nil; }
if (!object.class) {
@throw([NSException exceptionWithName:@"NoClass" reason:[NSString stringWithFormat:@"Object %@ is missing class %@", object, object.class] userInfo:nil]);
}
if (![self classIsInstanceTypeOfClass:object.class otherClass:classToVerify throwException:YES]) { return nil; }
return object;
}