File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
app/src/main/java/com/prateekcode/githubbrowser/adapter Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import com.prateekcode.githubbrowser.model.commit.CommitItem
1111import com.prateekcode.githubbrowser.util.CommitUtil
1212import com.prateekcode.githubbrowser.util.Utils
1313import kotlinx.android.synthetic.main.commit_single_item.view.*
14+ import java.lang.NullPointerException
1415
1516class CommitAdapter : RecyclerView .Adapter <CommitAdapter .CommitViewHolder >() {
1617
@@ -22,14 +23,14 @@ class CommitAdapter : RecyclerView.Adapter<CommitAdapter.CommitViewHolder>() {
2223 itemView.date_text_tv.text =
2324 Utils .getFormattedDateFromTimestamp(Utils .getDateToMilliSeconds(commitItem.commit.committer.date))
2425 itemView.commit_message_tv.text = commitItem.commit.message
25- if (commitItem.commit.committer.name.isNotEmpty()){
26+ if (commitItem.commit.committer.name.isNotEmpty()) {
2627 itemView.user_name_tv.text = commitItem.commit.committer.name
27- }else {
28+ } else {
2829 itemView.user_name_tv.text = " Not Available"
2930 }
30- if (commitItem.committer.avatar_url.isNotEmpty()) {
31+ try {
3132 itemView.avatar_iv.load(commitItem.committer.avatar_url)
32- }else {
33+ }catch (e : NullPointerException ) {
3334 itemView.avatar_iv.load(R .drawable.ic_avatar)
3435 }
3536 itemView.sha_key_initial.text = Utils .getSixLetterString(commitItem.sha)
You can’t perform that action at this time.
0 commit comments