iOS:fix when DoricContext is nil

This commit is contained in:
pengfei.zhou 2020-04-22 11:39:38 +08:00 committed by osborn
parent 229fc41de3
commit 2821d42ebd

View File

@ -34,6 +34,9 @@ @implementation DoricBridgeExtension
- (id)callNativeWithContextId:(NSString *)contextId module:(NSString *)module method:(NSString *)method callbackId:(NSString *)callbackId argument:(id)argument { - (id)callNativeWithContextId:(NSString *)contextId module:(NSString *)module method:(NSString *)method callbackId:(NSString *)callbackId argument:(id)argument {
__strong DoricContext *context = [[DoricContextManager instance] getContext:contextId]; __strong DoricContext *context = [[DoricContextManager instance] getContext:contextId];
if (!context) {
return nil;
}
DoricRegistry *registry = context.driver.registry; DoricRegistry *registry = context.driver.registry;
Class pluginClass = [registry acquireNativePlugin:module]; Class pluginClass = [registry acquireNativePlugin:module];
DoricNativePlugin *nativePlugin = context.pluginInstanceMap[module]; DoricNativePlugin *nativePlugin = context.pluginInstanceMap[module];