Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复空指针bug #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.os.Handler;
import android.os.Message;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
Expand Down Expand Up @@ -295,8 +296,11 @@ public int getPinYinFirstCharacter(int position) {
if (contact == null) {
return 0;
}

return contact.pinyinElement.pinyin.charAt(0);
if(!TextUtils.isEmpty(contact.pinyinElement.pinyin)){
return contact.pinyinElement.pinyin.charAt(0);
}else{
return 0;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package com.mogujie.tt.utils;

import android.text.TextUtils;

import com.mogujie.tt.imlib.proto.ContactEntity;

public class ContactUtils {

public static String getSectionName(ContactEntity contact) {
return contact.pinyinElement.pinyin.substring(0, 1);
if(!TextUtils.isEmpty(contact.pinyinElement.pinyin)){
return contact.pinyinElement.pinyin.substring(0, 1);
}else{
return "";
}
}

}