java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.intern...

记录一个bug
java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter item
image.png
image.png

我们先不看返回数据:

{
        "code":"200",
        "data":{
            "current":1,
            "hitCount":false,
            "optimizeCountSql":true,
            "orders":[],
            "pages":1,
            "records":[
                null
            ],
            "searchCount":true,
            "size":10,
            "total":1
        },
        "msg":"成功"
    }

一个列表 使用的是 BAV BaseQuickAdapter
我们定位到 CollectionSupplyListAdapter的 13行

image.png

这他妈 13行是 类定义的开始啊 直接是懵逼 草草
仔细观察日志:

image.png

item 但在这个适配器里哪有item啊 找到了convert方法中的参数item
class CollectionSupplyListAdapter constructor(
    layoutId: Int,
    data: ArrayList<CollectionSupplyListBean.DataDTO.RecordsDTO>
) :
    BaseQuickAdapter<CollectionSupplyListBean.DataDTO.RecordsDTO, BaseViewHolder>(layoutId, data),
    LoadMoreModule {
    override fun convert(holder: BaseViewHolder, item: CollectionSupplyListBean.DataDTO.RecordsDTO) {

        holder.setText(R.id.tv_item_supply_list_create_time, item.pubTime)
            .setText(R.id.tv_item_supply_list_title, item.supplyTitle)
//            .setText(R.id.tv_item_supply_type, if (item.supply_quote_type == "1") item.supply_quote else "面议")
            .setText(R.id.tv_item_supply_type, item.supplyQuoteTypeText)
            .setText(R.id.tv_item_supply_service_location, item.supplyArea)
            .setText(R.id.tv_item_supply_list_status, item.statusText)
        var businessType = holder.getView<TextView>(R.id.tv_item_supply_business_type)


        item.supplyType?.let {

            when (it) {
                "1" -> {
                    businessType.text = "供给类型:法律"
                }
                "2" -> {
                    businessType.text = "供给类型:财税"
                }
                "3" -> {
                    businessType.text = "供给类型:投融资"
                }
                "4" -> {
                    businessType.text = "供给类型:知产综合"
                }
            }

        }

    }
}

这个item 也就是条目的数据

image.png

我们找到网络请求的地方下上断点

image.png

再看返回数据:

{
        "code":"200",
        "data":{
            "current":1,
            "hitCount":false,
            "optimizeCountSql":true,
            "orders":[],
            "pages":1,
            "records":[
                null
            ],
            "searchCount":true,
            "size":10,
            "total":1
        },
        "msg":"成功"
    }

json 还能这样操作:

"records":[
                null
            ],

后台这样玩,会不会被骂娘呢? 这他妈压根不是 标准json啊,开发这么多年也是头一次遇到 浪费我快1个小时

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值