应用程序崩溃了

时间:2020-04-28 13:29:25

标签: android generics kotlin

我的应用程序不断崩溃。 该应用从一开始就崩溃了。我附上了与错误有关的logcat和代码部分。请帮助我:)

Here is the logcat

以及第14行的代码

class UserAdapter(
    mContext: Context,
    mUsers: List<Users>,
    isChatCheck: Boolean
) : RecyclerView.Adapter<UserAdapter.ViewHolder?>()

第44行的代码

{
    val user: Users? = mUsers[i]
    holder.userNameTXT.text = user!!.getusername()
    Picasso.get().load(user.getprofile()).placeholder(R.drawable.profile).into(holder.profileImageView)
}

1 个答案:

答案 0 :(得分:1)

错误表明

user.getprofile()

为空或为空。请调试该应用程序,并检查user.getProfile()是否返回空字符串或null

或添加一个空字符串验证

if(!user.getProfile().isEmpty())
Picasso.get().load(user.getprofile()).placeholder(R.drawable.profile).into(holder.profileImageView)