其中UserProfile是BaseData的一个结构体指针成员, 报错信息如下
conversation_list
--- FAIL: Test_gengine_pool_bot_inform_city_bot_ask_weather (0.08s)
panic: reflect: call of reflect.Value.FieldByName on zero Value [recovered]
panic: reflect: call of reflect.Value.FieldByName on zero Value
rule "bot_ask_name" "" salience 12 begin
end ` base := BaseStartConversation{ ConversationBaseData: ConversationBaseData{ ConversationLogic: *logicObj, UserId: 9819, NodeId: 9818, Node: &httpparams.GetOneRobotNodeResp{ NodeId: 9818, RobotNodeGeneralProperties: &robotnodedao.RobotNodeGeneralProperties{NickName: "node nick name"}, RobotNodeCharacterProperties: nil, }, }, } apis := make(map[string]interface{}) apis["println"] = fmt.Println apis["index"] = strings.Index pool, err := engine.NewGenginePool(10, 20, 1, rule1, apis)
其中UserProfile是BaseData的一个结构体指针成员, 报错信息如下 conversation_list --- FAIL: Test_gengine_pool_bot_inform_city_bot_ask_weather (0.08s) panic: reflect: call of reflect.Value.FieldByName on zero Value [recovered] panic: reflect: call of reflect.Value.FieldByName on zero Value
这个 我测试了,就是isNil执行完后,虽然命中了条件(BaseData.UserProfile==nil),但是还会继续 || 后面的那个BaseData.UserProfile.Name,访问了空指针,想问下这个执行逻辑是什么?isNil 不能搭配 || && 使用吗