Digital PCT265 defect CXTDT-552909 - Client crash prevention on invalid module JSON.
This commit is contained in:
parent
a5763d4516
commit
dde3e565a3
@ -365,6 +365,16 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
|
|||||||
|
|
||||||
- (void)addModulesToCache:(nonnull NSDictionary *)jsonDictionary queue:(nullable NSOperationQueue *)queue waitUntilFinished:(BOOL)waitUntilFinished completionBlock:(nullable void (^)(void))completionBlock {
|
- (void)addModulesToCache:(nonnull NSDictionary *)jsonDictionary queue:(nullable NSOperationQueue *)queue waitUntilFinished:(BOOL)waitUntilFinished completionBlock:(nullable void (^)(void))completionBlock {
|
||||||
[jsonDictionary enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
|
[jsonDictionary enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
|
||||||
|
if (![obj isKindOfClass:[NSDictionary class]]) {
|
||||||
|
MVMCoreErrorObject *error = [[MVMCoreErrorObject alloc]
|
||||||
|
initWithTitle:nil
|
||||||
|
messageToLog:[NSString stringWithFormat:@"Invalid module format. Cannot cache %@ as it's not an object", key]
|
||||||
|
code:ErrorCodeJSONNotDictionary
|
||||||
|
domain:ErrorDomainSystem
|
||||||
|
location:NSStringFromClass([self class])];
|
||||||
|
[MVMCoreLoggingHandler.sharedLoggingHandler addErrorToLog:error];
|
||||||
|
return;
|
||||||
|
}
|
||||||
[self addModuleToCache:obj module:key];
|
[self addModuleToCache:obj module:key];
|
||||||
}];
|
}];
|
||||||
__weak typeof(self) weakSelf = self;
|
__weak typeof(self) weakSelf = self;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user