Fixed an NPE when the users name is null
This commit is contained in:
parent
4d8c3d7d73
commit
3bcf2c81da
1 changed files with 8 additions and 6 deletions
|
@ -34,12 +34,14 @@ public class SocialUser {
|
|||
}
|
||||
|
||||
public void setName(String name) {
|
||||
int i = name.lastIndexOf(' ');
|
||||
if (i != -1) {
|
||||
firstName = name.substring(0, i);
|
||||
lastName = name.substring(i + 1);
|
||||
} else {
|
||||
firstName = name;
|
||||
if (name != null) {
|
||||
int i = name.lastIndexOf(' ');
|
||||
if (i != -1) {
|
||||
firstName = name.substring(0, i);
|
||||
lastName = name.substring(i + 1);
|
||||
} else {
|
||||
firstName = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue