提交 00996d60 authored 作者: JarvanMo's avatar JarvanMo

fix bugs due to NPE

上级 279ed1ea
......@@ -48,16 +48,20 @@ object FluwxResponseHandler {
}
private fun handleLaunchMiniProgramResponse(response: WXLaunchMiniProgram.Resp) {
val result = mapOf(
val result = mutableMapOf(
errStr to response.errStr,
WechatPluginKeys.TRANSACTION to response.transaction,
type to response.type,
errCode to response.errCode,
openId to response.openId,
"extMsg" to response.extMsg,
WechatPluginKeys.PLATFORM to WechatPluginKeys.ANDROID
)
response.extMsg?.let {
// "extMsg" to response.extMsg,
result["extMsg"] = response.extMsg
}
channel?.invokeMethod(WeChatPluginMethods.WE_CHAT_LAUNCHMINIPROGRAM_RESPONSE, result)
}
......
......@@ -16,7 +16,7 @@ class _LaunchMiniProgramPageState extends State<LaunchMiniProgramPage> {
super.initState();
fluwx.responseFromLaunchMiniProgram.listen((data) {
setState(() {
_result = "${data.extMsg}";
_result = "${data.errStr}";
});
});
......
......@@ -117,17 +117,28 @@ FlutterMethodChannel *fluwxMethodChannel = nil;
}
WXLaunchMiniProgramResp *miniProgramResp = (WXLaunchMiniProgramResp *) resp;
NSDictionary *result = @{
NSDictionary *commonResult = @{
description: miniProgramResp.description == nil ?@"":miniProgramResp.description,
errStr: miniProgramResp.errStr == nil ?@"":miniProgramResp.errStr,
errCode: @(miniProgramResp.errCode),
type: miniProgramResp.type == nil ?@1:@(miniProgramResp.type),
fluwxKeyPlatform: fluwxKeyIOS,
@"extMsg":miniProgramResp.extMsg
};
NSMutableDictionary *result = [NSMutableDictionary dictionaryWithDictionary:commonResult];
if(miniProgramResp.extMsg != nil){
result[@"extMsg"] = miniProgramResp.extMsg;
}
// @"extMsg":miniProgramResp.extMsg == nil?@"":miniProgramResp.extMsg
[fluwxMethodChannel invokeMethod:@"onLaunchMiniProgramResponse" arguments:result];
} else if ([resp isKindOfClass:[WXInvoiceAuthInsertResp class]]) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论